mirror of
https://github.com/status-im/consul.git
synced 2025-02-20 09:28:34 +00:00
Having this type live in the agent/consul package makes it difficult to put anything that relies on token resolution (e.g. the new gRPC services) in separate packages without introducing import cycles. For example, if package foo imports agent/consul for the ACLResolveResult type it means that agent/consul cannot import foo to register its service. We've previously worked around this by wrapping the ACLResolver to "downgrade" its return type to an acl.Authorizer - aside from the added complexity, this also loses the resolved identity information. In the future, we may want to move the whole ACLResolver into the acl/resolver package. For now, putting the result type there at least, fixes the immediate import cycle issues.
49 lines
1.3 KiB
Go
49 lines
1.3 KiB
Go
// Code generated by mockery v2.12.0. DO NOT EDIT.
|
|
|
|
package serverdiscovery
|
|
|
|
import (
|
|
acl "github.com/hashicorp/consul/acl"
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
resolver "github.com/hashicorp/consul/acl/resolver"
|
|
|
|
testing "testing"
|
|
)
|
|
|
|
// MockACLResolver is an autogenerated mock type for the ACLResolver type
|
|
type MockACLResolver struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// ResolveTokenAndDefaultMeta provides a mock function with given fields: _a0, _a1, _a2
|
|
func (_m *MockACLResolver) ResolveTokenAndDefaultMeta(_a0 string, _a1 *acl.EnterpriseMeta, _a2 *acl.AuthorizerContext) (resolver.Result, error) {
|
|
ret := _m.Called(_a0, _a1, _a2)
|
|
|
|
var r0 resolver.Result
|
|
if rf, ok := ret.Get(0).(func(string, *acl.EnterpriseMeta, *acl.AuthorizerContext) resolver.Result); ok {
|
|
r0 = rf(_a0, _a1, _a2)
|
|
} else {
|
|
r0 = ret.Get(0).(resolver.Result)
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(string, *acl.EnterpriseMeta, *acl.AuthorizerContext) error); ok {
|
|
r1 = rf(_a0, _a1, _a2)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// NewMockACLResolver creates a new instance of MockACLResolver. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations.
|
|
func NewMockACLResolver(t testing.TB) *MockACLResolver {
|
|
mock := &MockACLResolver{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|