chore: upgrade mockery to v2 and regenerate (#12836)

This commit is contained in:
R.B. Boyer 2022-04-21 09:48:21 -05:00 committed by GitHub
parent ffcce96d7f
commit bbd38e95ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 144 additions and 27 deletions

View File

@ -5,7 +5,7 @@ SHELL = bash
GOTOOLS = \
github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs@master \
github.com/hashicorp/go-bindata/go-bindata@master \
github.com/vektra/mockery/cmd/mockery@master \
github.com/vektra/mockery/v2@latest \
github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.2 \
github.com/hashicorp/lint-consul-retry@master

View File

@ -1,7 +1,12 @@
// Code generated by mockery v1.0.0
// Code generated by mockery v2.11.0. DO NOT EDIT.
package cachetype
import mock "github.com/stretchr/testify/mock"
import (
testing "testing"
mock "github.com/stretchr/testify/mock"
)
// MockRPC is an autogenerated mock type for the RPC type
type MockRPC struct {
@ -21,3 +26,12 @@ func (_m *MockRPC) RPC(method string, args interface{}, reply interface{}) error
return r0
}
// NewMockRPC creates a new instance of MockRPC. It also registers a cleanup function to assert the mocks expectations.
func NewMockRPC(t testing.TB) *MockRPC {
mock := &MockRPC{}
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,6 +1,6 @@
package cachetype
//go:generate mockery -all -inpkg
//go:generate mockery --all --inpackage
// RPC is an interface that an RPC client must implement. This is a helper
// interface that is implemented by the agent delegate so that Type

View File

@ -33,7 +33,7 @@ import (
"github.com/hashicorp/consul/lib/ttlcache"
)
//go:generate mockery -all -inpkg
//go:generate mockery --all --inpackage
// TODO(kit): remove the namespace from these once the metrics themselves change
var Gauges = []prometheus.GaugeDefinition{

View File

@ -1,8 +1,12 @@
// Code generated by mockery v1.0.0. DO NOT EDIT.
// Code generated by mockery v2.11.0. DO NOT EDIT.
package cache
import mock "github.com/stretchr/testify/mock"
import (
testing "testing"
mock "github.com/stretchr/testify/mock"
)
// MockRequest is an autogenerated mock type for the Request type
type MockRequest struct {
@ -22,3 +26,12 @@ func (_m *MockRequest) CacheInfo() RequestInfo {
return r0
}
// NewMockRequest creates a new instance of MockRequest. It also registers a cleanup function to assert the mocks expectations.
func NewMockRequest(t testing.TB) *MockRequest {
mock := &MockRequest{}
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,8 +1,12 @@
// Code generated by mockery v1.0.0. DO NOT EDIT.
// Code generated by mockery v2.11.0. DO NOT EDIT.
package cache
import mock "github.com/stretchr/testify/mock"
import (
testing "testing"
mock "github.com/stretchr/testify/mock"
)
// MockType is an autogenerated mock type for the Type type
type MockType struct {
@ -43,3 +47,12 @@ func (_m *MockType) RegisterOptions() RegisterOptions {
return r0
}
// NewMockType creates a new instance of MockType. It also registers a cleanup function to assert the mocks expectations.
func NewMockType(t testing.TB) *MockType {
mock := &MockType{}
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,11 +1,13 @@
// Code generated by mockery v1.0.0. DO NOT EDIT.
// Code generated by mockery v2.11.0. DO NOT EDIT.
package ca
import (
x509 "crypto/x509"
testing "testing"
mock "github.com/stretchr/testify/mock"
x509 "crypto/x509"
)
// MockProvider is an autogenerated mock type for the Provider type
@ -245,3 +247,12 @@ func (_m *MockProvider) SupportsCrossSigning() (bool, error) {
return r0, r1
}
// NewMockProvider creates a new instance of MockProvider. It also registers a cleanup function to assert the mocks expectations.
func NewMockProvider(t testing.TB) *MockProvider {
mock := &MockProvider{}
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -5,7 +5,7 @@ import (
"errors"
)
//go:generate mockery -name Provider -inpkg
//go:generate mockery --name Provider --inpackage
// ErrRateLimited is a sentinel error value Providers may return from any method
// to indicate that the operation can't complete due to a temporary rate limit.

View File

@ -1,8 +1,10 @@
// Code generated by mockery v1.0.0. DO NOT EDIT.
// Code generated by mockery v2.11.0. DO NOT EDIT.
package autopilotevents
import (
testing "testing"
stream "github.com/hashicorp/consul/agent/consul/stream"
mock "github.com/stretchr/testify/mock"
)
@ -16,3 +18,12 @@ type MockPublisher struct {
func (_m *MockPublisher) Publish(_a0 []stream.Event) {
_m.Called(_a0)
}
// NewMockPublisher creates a new instance of MockPublisher. It also registers a cleanup function to assert the mocks expectations.
func NewMockPublisher(t testing.TB) *MockPublisher {
mock := &MockPublisher{}
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,4 +1,4 @@
// Code generated by mockery v1.0.0. DO NOT EDIT.
// Code generated by mockery v2.11.0. DO NOT EDIT.
package autopilotevents
@ -8,6 +8,8 @@ import (
structs "github.com/hashicorp/consul/agent/structs"
testing "testing"
types "github.com/hashicorp/consul/types"
)
@ -45,3 +47,12 @@ func (_m *MockStateStore) GetNodeID(_a0 types.NodeID, _a1 *acl.EnterpriseMeta) (
return r0, r1, r2
}
// NewMockStateStore creates a new instance of MockStateStore. It also registers a cleanup function to assert the mocks expectations.
func NewMockStateStore(t testing.TB) *MockStateStore {
mock := &MockStateStore{}
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,11 +1,13 @@
// Code generated by mockery v1.0.0. DO NOT EDIT.
// Code generated by mockery v2.11.0. DO NOT EDIT.
package autopilotevents
import (
time "time"
testing "testing"
mock "github.com/stretchr/testify/mock"
time "time"
)
// mockTimeProvider is an autogenerated mock type for the timeProvider type
@ -26,3 +28,12 @@ func (_m *mockTimeProvider) Now() time.Time {
return r0
}
// newMockTimeProvider creates a new instance of mockTimeProvider. It also registers a cleanup function to assert the mocks expectations.
func newMockTimeProvider(t testing.TB) *mockTimeProvider {
mock := &mockTimeProvider{}
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -7,11 +7,12 @@ import (
"sync"
"time"
autopilot "github.com/hashicorp/raft-autopilot"
"github.com/hashicorp/consul/acl"
"github.com/hashicorp/consul/agent/consul/stream"
"github.com/hashicorp/consul/agent/structs"
"github.com/hashicorp/consul/types"
autopilot "github.com/hashicorp/raft-autopilot"
)
const (
@ -111,17 +112,17 @@ func NewReadyServersEventPublisher(config Config) *ReadyServersEventPublisher {
}
}
//go:generate mockery -name StateStore -inpkg -testonly
//go:generate mockery --name StateStore --inpackage --testonly
type StateStore interface {
GetNodeID(types.NodeID, *acl.EnterpriseMeta) (uint64, *structs.Node, error)
}
//go:generate mockery -name Publisher -inpkg -testonly
//go:generate mockery --name Publisher --inpackage --testonly
type Publisher interface {
Publish([]stream.Event)
}
//go:generate mockery -name timeProvider -inpkg -testonly
//go:generate mockery --name timeProvider --inpackage --testonly
type timeProvider interface {
Now() time.Time
}

View File

@ -1,10 +1,12 @@
// Code generated by mockery v1.0.0. DO NOT EDIT.
// Code generated by mockery v2.11.0. DO NOT EDIT.
package connectca
import (
acl "github.com/hashicorp/consul/acl"
mock "github.com/stretchr/testify/mock"
testing "testing"
)
// MockACLResolver is an autogenerated mock type for the ACLResolver type
@ -34,3 +36,12 @@ func (_m *MockACLResolver) ResolveTokenAndDefaultMeta(token string, entMeta *acl
return r0, r1
}
// NewMockACLResolver creates a new instance of MockACLResolver. It also registers a cleanup function to assert the mocks expectations.
func NewMockACLResolver(t testing.TB) *MockACLResolver {
mock := &MockACLResolver{}
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,4 +1,4 @@
// Code generated by mockery v1.0.0. DO NOT EDIT.
// Code generated by mockery v2.11.0. DO NOT EDIT.
package connectca
@ -8,6 +8,8 @@ import (
structs "github.com/hashicorp/consul/agent/structs"
testing "testing"
x509 "crypto/x509"
)
@ -38,3 +40,12 @@ func (_m *MockCAManager) AuthorizeAndSignCertificate(csr *x509.CertificateReques
return r0, r1
}
// NewMockCAManager creates a new instance of MockCAManager. It also registers a cleanup function to assert the mocks expectations.
func NewMockCAManager(t testing.TB) *MockCAManager {
mock := &MockCAManager{}
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -39,12 +39,12 @@ type StateStore interface {
AbandonCh() <-chan struct{}
}
//go:generate mockery -name ACLResolver -inpkg
//go:generate mockery --name ACLResolver --inpackage
type ACLResolver interface {
ResolveTokenAndDefaultMeta(token string, entMeta *acl.EnterpriseMeta, authzContext *acl.AuthorizerContext) (acl.Authorizer, error)
}
//go:generate mockery -name CAManager -inpkg
//go:generate mockery --name CAManager --inpackage
type CAManager interface {
AuthorizeAndSignCertificate(csr *x509.CertificateRequest, authz acl.Authorizer) (*structs.IssuedCert, error)
}

View File

@ -1,11 +1,12 @@
// Code generated by mockery v1.0.0. DO NOT EDIT.
// Code generated by mockery v2.11.0. DO NOT EDIT.
package dataplane
import (
acl "github.com/hashicorp/consul/acl"
mock "github.com/stretchr/testify/mock"
acl "github.com/hashicorp/consul/acl"
testing "testing"
)
// MockACLResolver is an autogenerated mock type for the ACLResolver type
@ -35,3 +36,12 @@ func (_m *MockACLResolver) ResolveTokenAndDefaultMeta(_a0 string, _a1 *acl.Enter
return r0, r1
}
// NewMockACLResolver creates a new instance of MockACLResolver. It also registers a cleanup function to assert the mocks expectations.
func NewMockACLResolver(t testing.TB) *MockACLResolver {
mock := &MockACLResolver{}
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -26,7 +26,7 @@ type StateStore interface {
ServiceNode(string, string, string, *acl.EnterpriseMeta) (uint64, *structs.ServiceNode, error)
}
//go:generate mockery -name ACLResolver -inpkg
//go:generate mockery --name ACLResolver --inpackage
type ACLResolver interface {
ResolveTokenAndDefaultMeta(string, *acl.EnterpriseMeta, *acl.AuthorizerContext) (acl.Authorizer, error)
}