mirror of https://github.com/hashicorp/consul
433 lines
14 KiB
Go
433 lines
14 KiB
Go
|
// Code generated by mockery v2.37.1. DO NOT EDIT.
|
||
|
|
||
|
package cachemock
|
||
|
|
||
|
import (
|
||
|
cache "github.com/hashicorp/consul/internal/controller/cache"
|
||
|
mock "github.com/stretchr/testify/mock"
|
||
|
|
||
|
pbresource "github.com/hashicorp/consul/proto-public/pbresource"
|
||
|
)
|
||
|
|
||
|
// ReadOnlyCache is an autogenerated mock type for the ReadOnlyCache type
|
||
|
type ReadOnlyCache struct {
|
||
|
mock.Mock
|
||
|
}
|
||
|
|
||
|
type ReadOnlyCache_Expecter struct {
|
||
|
mock *mock.Mock
|
||
|
}
|
||
|
|
||
|
func (_m *ReadOnlyCache) EXPECT() *ReadOnlyCache_Expecter {
|
||
|
return &ReadOnlyCache_Expecter{mock: &_m.Mock}
|
||
|
}
|
||
|
|
||
|
// Get provides a mock function with given fields: it, indexName, args
|
||
|
func (_m *ReadOnlyCache) Get(it *pbresource.Type, indexName string, args ...interface{}) (*pbresource.Resource, error) {
|
||
|
var _ca []interface{}
|
||
|
_ca = append(_ca, it, indexName)
|
||
|
_ca = append(_ca, args...)
|
||
|
ret := _m.Called(_ca...)
|
||
|
|
||
|
var r0 *pbresource.Resource
|
||
|
var r1 error
|
||
|
if rf, ok := ret.Get(0).(func(*pbresource.Type, string, ...interface{}) (*pbresource.Resource, error)); ok {
|
||
|
return rf(it, indexName, args...)
|
||
|
}
|
||
|
if rf, ok := ret.Get(0).(func(*pbresource.Type, string, ...interface{}) *pbresource.Resource); ok {
|
||
|
r0 = rf(it, indexName, args...)
|
||
|
} else {
|
||
|
if ret.Get(0) != nil {
|
||
|
r0 = ret.Get(0).(*pbresource.Resource)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if rf, ok := ret.Get(1).(func(*pbresource.Type, string, ...interface{}) error); ok {
|
||
|
r1 = rf(it, indexName, args...)
|
||
|
} else {
|
||
|
r1 = ret.Error(1)
|
||
|
}
|
||
|
|
||
|
return r0, r1
|
||
|
}
|
||
|
|
||
|
// ReadOnlyCache_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
|
||
|
type ReadOnlyCache_Get_Call struct {
|
||
|
*mock.Call
|
||
|
}
|
||
|
|
||
|
// Get is a helper method to define mock.On call
|
||
|
// - it *pbresource.Type
|
||
|
// - indexName string
|
||
|
// - args ...interface{}
|
||
|
func (_e *ReadOnlyCache_Expecter) Get(it interface{}, indexName interface{}, args ...interface{}) *ReadOnlyCache_Get_Call {
|
||
|
return &ReadOnlyCache_Get_Call{Call: _e.mock.On("Get",
|
||
|
append([]interface{}{it, indexName}, args...)...)}
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_Get_Call) Run(run func(it *pbresource.Type, indexName string, args ...interface{})) *ReadOnlyCache_Get_Call {
|
||
|
_c.Call.Run(func(args mock.Arguments) {
|
||
|
variadicArgs := make([]interface{}, len(args)-2)
|
||
|
for i, a := range args[2:] {
|
||
|
if a != nil {
|
||
|
variadicArgs[i] = a.(interface{})
|
||
|
}
|
||
|
}
|
||
|
run(args[0].(*pbresource.Type), args[1].(string), variadicArgs...)
|
||
|
})
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_Get_Call) Return(_a0 *pbresource.Resource, _a1 error) *ReadOnlyCache_Get_Call {
|
||
|
_c.Call.Return(_a0, _a1)
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_Get_Call) RunAndReturn(run func(*pbresource.Type, string, ...interface{}) (*pbresource.Resource, error)) *ReadOnlyCache_Get_Call {
|
||
|
_c.Call.Return(run)
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
// List provides a mock function with given fields: it, indexName, args
|
||
|
func (_m *ReadOnlyCache) List(it *pbresource.Type, indexName string, args ...interface{}) ([]*pbresource.Resource, error) {
|
||
|
var _ca []interface{}
|
||
|
_ca = append(_ca, it, indexName)
|
||
|
_ca = append(_ca, args...)
|
||
|
ret := _m.Called(_ca...)
|
||
|
|
||
|
var r0 []*pbresource.Resource
|
||
|
var r1 error
|
||
|
if rf, ok := ret.Get(0).(func(*pbresource.Type, string, ...interface{}) ([]*pbresource.Resource, error)); ok {
|
||
|
return rf(it, indexName, args...)
|
||
|
}
|
||
|
if rf, ok := ret.Get(0).(func(*pbresource.Type, string, ...interface{}) []*pbresource.Resource); ok {
|
||
|
r0 = rf(it, indexName, args...)
|
||
|
} else {
|
||
|
if ret.Get(0) != nil {
|
||
|
r0 = ret.Get(0).([]*pbresource.Resource)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if rf, ok := ret.Get(1).(func(*pbresource.Type, string, ...interface{}) error); ok {
|
||
|
r1 = rf(it, indexName, args...)
|
||
|
} else {
|
||
|
r1 = ret.Error(1)
|
||
|
}
|
||
|
|
||
|
return r0, r1
|
||
|
}
|
||
|
|
||
|
// ReadOnlyCache_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'
|
||
|
type ReadOnlyCache_List_Call struct {
|
||
|
*mock.Call
|
||
|
}
|
||
|
|
||
|
// List is a helper method to define mock.On call
|
||
|
// - it *pbresource.Type
|
||
|
// - indexName string
|
||
|
// - args ...interface{}
|
||
|
func (_e *ReadOnlyCache_Expecter) List(it interface{}, indexName interface{}, args ...interface{}) *ReadOnlyCache_List_Call {
|
||
|
return &ReadOnlyCache_List_Call{Call: _e.mock.On("List",
|
||
|
append([]interface{}{it, indexName}, args...)...)}
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_List_Call) Run(run func(it *pbresource.Type, indexName string, args ...interface{})) *ReadOnlyCache_List_Call {
|
||
|
_c.Call.Run(func(args mock.Arguments) {
|
||
|
variadicArgs := make([]interface{}, len(args)-2)
|
||
|
for i, a := range args[2:] {
|
||
|
if a != nil {
|
||
|
variadicArgs[i] = a.(interface{})
|
||
|
}
|
||
|
}
|
||
|
run(args[0].(*pbresource.Type), args[1].(string), variadicArgs...)
|
||
|
})
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_List_Call) Return(_a0 []*pbresource.Resource, _a1 error) *ReadOnlyCache_List_Call {
|
||
|
_c.Call.Return(_a0, _a1)
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_List_Call) RunAndReturn(run func(*pbresource.Type, string, ...interface{}) ([]*pbresource.Resource, error)) *ReadOnlyCache_List_Call {
|
||
|
_c.Call.Return(run)
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
// ListIterator provides a mock function with given fields: it, indexName, args
|
||
|
func (_m *ReadOnlyCache) ListIterator(it *pbresource.Type, indexName string, args ...interface{}) (cache.ResourceIterator, error) {
|
||
|
var _ca []interface{}
|
||
|
_ca = append(_ca, it, indexName)
|
||
|
_ca = append(_ca, args...)
|
||
|
ret := _m.Called(_ca...)
|
||
|
|
||
|
var r0 cache.ResourceIterator
|
||
|
var r1 error
|
||
|
if rf, ok := ret.Get(0).(func(*pbresource.Type, string, ...interface{}) (cache.ResourceIterator, error)); ok {
|
||
|
return rf(it, indexName, args...)
|
||
|
}
|
||
|
if rf, ok := ret.Get(0).(func(*pbresource.Type, string, ...interface{}) cache.ResourceIterator); ok {
|
||
|
r0 = rf(it, indexName, args...)
|
||
|
} else {
|
||
|
if ret.Get(0) != nil {
|
||
|
r0 = ret.Get(0).(cache.ResourceIterator)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if rf, ok := ret.Get(1).(func(*pbresource.Type, string, ...interface{}) error); ok {
|
||
|
r1 = rf(it, indexName, args...)
|
||
|
} else {
|
||
|
r1 = ret.Error(1)
|
||
|
}
|
||
|
|
||
|
return r0, r1
|
||
|
}
|
||
|
|
||
|
// ReadOnlyCache_ListIterator_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListIterator'
|
||
|
type ReadOnlyCache_ListIterator_Call struct {
|
||
|
*mock.Call
|
||
|
}
|
||
|
|
||
|
// ListIterator is a helper method to define mock.On call
|
||
|
// - it *pbresource.Type
|
||
|
// - indexName string
|
||
|
// - args ...interface{}
|
||
|
func (_e *ReadOnlyCache_Expecter) ListIterator(it interface{}, indexName interface{}, args ...interface{}) *ReadOnlyCache_ListIterator_Call {
|
||
|
return &ReadOnlyCache_ListIterator_Call{Call: _e.mock.On("ListIterator",
|
||
|
append([]interface{}{it, indexName}, args...)...)}
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_ListIterator_Call) Run(run func(it *pbresource.Type, indexName string, args ...interface{})) *ReadOnlyCache_ListIterator_Call {
|
||
|
_c.Call.Run(func(args mock.Arguments) {
|
||
|
variadicArgs := make([]interface{}, len(args)-2)
|
||
|
for i, a := range args[2:] {
|
||
|
if a != nil {
|
||
|
variadicArgs[i] = a.(interface{})
|
||
|
}
|
||
|
}
|
||
|
run(args[0].(*pbresource.Type), args[1].(string), variadicArgs...)
|
||
|
})
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_ListIterator_Call) Return(_a0 cache.ResourceIterator, _a1 error) *ReadOnlyCache_ListIterator_Call {
|
||
|
_c.Call.Return(_a0, _a1)
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_ListIterator_Call) RunAndReturn(run func(*pbresource.Type, string, ...interface{}) (cache.ResourceIterator, error)) *ReadOnlyCache_ListIterator_Call {
|
||
|
_c.Call.Return(run)
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
// Parents provides a mock function with given fields: it, indexName, args
|
||
|
func (_m *ReadOnlyCache) Parents(it *pbresource.Type, indexName string, args ...interface{}) ([]*pbresource.Resource, error) {
|
||
|
var _ca []interface{}
|
||
|
_ca = append(_ca, it, indexName)
|
||
|
_ca = append(_ca, args...)
|
||
|
ret := _m.Called(_ca...)
|
||
|
|
||
|
var r0 []*pbresource.Resource
|
||
|
var r1 error
|
||
|
if rf, ok := ret.Get(0).(func(*pbresource.Type, string, ...interface{}) ([]*pbresource.Resource, error)); ok {
|
||
|
return rf(it, indexName, args...)
|
||
|
}
|
||
|
if rf, ok := ret.Get(0).(func(*pbresource.Type, string, ...interface{}) []*pbresource.Resource); ok {
|
||
|
r0 = rf(it, indexName, args...)
|
||
|
} else {
|
||
|
if ret.Get(0) != nil {
|
||
|
r0 = ret.Get(0).([]*pbresource.Resource)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if rf, ok := ret.Get(1).(func(*pbresource.Type, string, ...interface{}) error); ok {
|
||
|
r1 = rf(it, indexName, args...)
|
||
|
} else {
|
||
|
r1 = ret.Error(1)
|
||
|
}
|
||
|
|
||
|
return r0, r1
|
||
|
}
|
||
|
|
||
|
// ReadOnlyCache_Parents_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Parents'
|
||
|
type ReadOnlyCache_Parents_Call struct {
|
||
|
*mock.Call
|
||
|
}
|
||
|
|
||
|
// Parents is a helper method to define mock.On call
|
||
|
// - it *pbresource.Type
|
||
|
// - indexName string
|
||
|
// - args ...interface{}
|
||
|
func (_e *ReadOnlyCache_Expecter) Parents(it interface{}, indexName interface{}, args ...interface{}) *ReadOnlyCache_Parents_Call {
|
||
|
return &ReadOnlyCache_Parents_Call{Call: _e.mock.On("Parents",
|
||
|
append([]interface{}{it, indexName}, args...)...)}
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_Parents_Call) Run(run func(it *pbresource.Type, indexName string, args ...interface{})) *ReadOnlyCache_Parents_Call {
|
||
|
_c.Call.Run(func(args mock.Arguments) {
|
||
|
variadicArgs := make([]interface{}, len(args)-2)
|
||
|
for i, a := range args[2:] {
|
||
|
if a != nil {
|
||
|
variadicArgs[i] = a.(interface{})
|
||
|
}
|
||
|
}
|
||
|
run(args[0].(*pbresource.Type), args[1].(string), variadicArgs...)
|
||
|
})
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_Parents_Call) Return(_a0 []*pbresource.Resource, _a1 error) *ReadOnlyCache_Parents_Call {
|
||
|
_c.Call.Return(_a0, _a1)
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_Parents_Call) RunAndReturn(run func(*pbresource.Type, string, ...interface{}) ([]*pbresource.Resource, error)) *ReadOnlyCache_Parents_Call {
|
||
|
_c.Call.Return(run)
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
// ParentsIterator provides a mock function with given fields: it, indexName, args
|
||
|
func (_m *ReadOnlyCache) ParentsIterator(it *pbresource.Type, indexName string, args ...interface{}) (cache.ResourceIterator, error) {
|
||
|
var _ca []interface{}
|
||
|
_ca = append(_ca, it, indexName)
|
||
|
_ca = append(_ca, args...)
|
||
|
ret := _m.Called(_ca...)
|
||
|
|
||
|
var r0 cache.ResourceIterator
|
||
|
var r1 error
|
||
|
if rf, ok := ret.Get(0).(func(*pbresource.Type, string, ...interface{}) (cache.ResourceIterator, error)); ok {
|
||
|
return rf(it, indexName, args...)
|
||
|
}
|
||
|
if rf, ok := ret.Get(0).(func(*pbresource.Type, string, ...interface{}) cache.ResourceIterator); ok {
|
||
|
r0 = rf(it, indexName, args...)
|
||
|
} else {
|
||
|
if ret.Get(0) != nil {
|
||
|
r0 = ret.Get(0).(cache.ResourceIterator)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if rf, ok := ret.Get(1).(func(*pbresource.Type, string, ...interface{}) error); ok {
|
||
|
r1 = rf(it, indexName, args...)
|
||
|
} else {
|
||
|
r1 = ret.Error(1)
|
||
|
}
|
||
|
|
||
|
return r0, r1
|
||
|
}
|
||
|
|
||
|
// ReadOnlyCache_ParentsIterator_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParentsIterator'
|
||
|
type ReadOnlyCache_ParentsIterator_Call struct {
|
||
|
*mock.Call
|
||
|
}
|
||
|
|
||
|
// ParentsIterator is a helper method to define mock.On call
|
||
|
// - it *pbresource.Type
|
||
|
// - indexName string
|
||
|
// - args ...interface{}
|
||
|
func (_e *ReadOnlyCache_Expecter) ParentsIterator(it interface{}, indexName interface{}, args ...interface{}) *ReadOnlyCache_ParentsIterator_Call {
|
||
|
return &ReadOnlyCache_ParentsIterator_Call{Call: _e.mock.On("ParentsIterator",
|
||
|
append([]interface{}{it, indexName}, args...)...)}
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_ParentsIterator_Call) Run(run func(it *pbresource.Type, indexName string, args ...interface{})) *ReadOnlyCache_ParentsIterator_Call {
|
||
|
_c.Call.Run(func(args mock.Arguments) {
|
||
|
variadicArgs := make([]interface{}, len(args)-2)
|
||
|
for i, a := range args[2:] {
|
||
|
if a != nil {
|
||
|
variadicArgs[i] = a.(interface{})
|
||
|
}
|
||
|
}
|
||
|
run(args[0].(*pbresource.Type), args[1].(string), variadicArgs...)
|
||
|
})
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_ParentsIterator_Call) Return(_a0 cache.ResourceIterator, _a1 error) *ReadOnlyCache_ParentsIterator_Call {
|
||
|
_c.Call.Return(_a0, _a1)
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_ParentsIterator_Call) RunAndReturn(run func(*pbresource.Type, string, ...interface{}) (cache.ResourceIterator, error)) *ReadOnlyCache_ParentsIterator_Call {
|
||
|
_c.Call.Return(run)
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
// Query provides a mock function with given fields: name, args
|
||
|
func (_m *ReadOnlyCache) Query(name string, args ...interface{}) (cache.ResourceIterator, error) {
|
||
|
var _ca []interface{}
|
||
|
_ca = append(_ca, name)
|
||
|
_ca = append(_ca, args...)
|
||
|
ret := _m.Called(_ca...)
|
||
|
|
||
|
var r0 cache.ResourceIterator
|
||
|
var r1 error
|
||
|
if rf, ok := ret.Get(0).(func(string, ...interface{}) (cache.ResourceIterator, error)); ok {
|
||
|
return rf(name, args...)
|
||
|
}
|
||
|
if rf, ok := ret.Get(0).(func(string, ...interface{}) cache.ResourceIterator); ok {
|
||
|
r0 = rf(name, args...)
|
||
|
} else {
|
||
|
if ret.Get(0) != nil {
|
||
|
r0 = ret.Get(0).(cache.ResourceIterator)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if rf, ok := ret.Get(1).(func(string, ...interface{}) error); ok {
|
||
|
r1 = rf(name, args...)
|
||
|
} else {
|
||
|
r1 = ret.Error(1)
|
||
|
}
|
||
|
|
||
|
return r0, r1
|
||
|
}
|
||
|
|
||
|
// ReadOnlyCache_Query_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Query'
|
||
|
type ReadOnlyCache_Query_Call struct {
|
||
|
*mock.Call
|
||
|
}
|
||
|
|
||
|
// Query is a helper method to define mock.On call
|
||
|
// - name string
|
||
|
// - args ...interface{}
|
||
|
func (_e *ReadOnlyCache_Expecter) Query(name interface{}, args ...interface{}) *ReadOnlyCache_Query_Call {
|
||
|
return &ReadOnlyCache_Query_Call{Call: _e.mock.On("Query",
|
||
|
append([]interface{}{name}, args...)...)}
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_Query_Call) Run(run func(name string, args ...interface{})) *ReadOnlyCache_Query_Call {
|
||
|
_c.Call.Run(func(args mock.Arguments) {
|
||
|
variadicArgs := make([]interface{}, len(args)-1)
|
||
|
for i, a := range args[1:] {
|
||
|
if a != nil {
|
||
|
variadicArgs[i] = a.(interface{})
|
||
|
}
|
||
|
}
|
||
|
run(args[0].(string), variadicArgs...)
|
||
|
})
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_Query_Call) Return(_a0 cache.ResourceIterator, _a1 error) *ReadOnlyCache_Query_Call {
|
||
|
_c.Call.Return(_a0, _a1)
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
func (_c *ReadOnlyCache_Query_Call) RunAndReturn(run func(string, ...interface{}) (cache.ResourceIterator, error)) *ReadOnlyCache_Query_Call {
|
||
|
_c.Call.Return(run)
|
||
|
return _c
|
||
|
}
|
||
|
|
||
|
// NewReadOnlyCache creates a new instance of ReadOnlyCache. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||
|
// The first argument is typically a *testing.T value.
|
||
|
func NewReadOnlyCache(t interface {
|
||
|
mock.TestingT
|
||
|
Cleanup(func())
|
||
|
}) *ReadOnlyCache {
|
||
|
mock := &ReadOnlyCache{}
|
||
|
mock.Mock.Test(t)
|
||
|
|
||
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||
|
|
||
|
return mock
|
||
|
}
|