consul/internal/controller/cache/cachemock/mock_Cache.go

638 lines
19 KiB
Go
Raw Normal View History

// Code generated by mockery v2.37.1. DO NOT EDIT.
package cachemock
import (
cache "github.com/hashicorp/consul/internal/controller/cache"
index "github.com/hashicorp/consul/internal/controller/cache/index"
mock "github.com/stretchr/testify/mock"
pbresource "github.com/hashicorp/consul/proto-public/pbresource"
)
// Cache is an autogenerated mock type for the Cache type
type Cache struct {
mock.Mock
}
type Cache_Expecter struct {
mock *mock.Mock
}
func (_m *Cache) EXPECT() *Cache_Expecter {
return &Cache_Expecter{mock: &_m.Mock}
}
// AddIndex provides a mock function with given fields: it, _a1
func (_m *Cache) AddIndex(it *pbresource.Type, _a1 *index.Index) error {
ret := _m.Called(it, _a1)
var r0 error
if rf, ok := ret.Get(0).(func(*pbresource.Type, *index.Index) error); ok {
r0 = rf(it, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// Cache_AddIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddIndex'
type Cache_AddIndex_Call struct {
*mock.Call
}
// AddIndex is a helper method to define mock.On call
// - it *pbresource.Type
// - _a1 *index.Index
func (_e *Cache_Expecter) AddIndex(it interface{}, _a1 interface{}) *Cache_AddIndex_Call {
return &Cache_AddIndex_Call{Call: _e.mock.On("AddIndex", it, _a1)}
}
func (_c *Cache_AddIndex_Call) Run(run func(it *pbresource.Type, _a1 *index.Index)) *Cache_AddIndex_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*pbresource.Type), args[1].(*index.Index))
})
return _c
}
func (_c *Cache_AddIndex_Call) Return(_a0 error) *Cache_AddIndex_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Cache_AddIndex_Call) RunAndReturn(run func(*pbresource.Type, *index.Index) error) *Cache_AddIndex_Call {
_c.Call.Return(run)
return _c
}
// AddQuery provides a mock function with given fields: name, fn
func (_m *Cache) AddQuery(name string, fn cache.Query) error {
ret := _m.Called(name, fn)
var r0 error
if rf, ok := ret.Get(0).(func(string, cache.Query) error); ok {
r0 = rf(name, fn)
} else {
r0 = ret.Error(0)
}
return r0
}
// Cache_AddQuery_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddQuery'
type Cache_AddQuery_Call struct {
*mock.Call
}
// AddQuery is a helper method to define mock.On call
// - name string
// - fn cache.Query
func (_e *Cache_Expecter) AddQuery(name interface{}, fn interface{}) *Cache_AddQuery_Call {
return &Cache_AddQuery_Call{Call: _e.mock.On("AddQuery", name, fn)}
}
func (_c *Cache_AddQuery_Call) Run(run func(name string, fn cache.Query)) *Cache_AddQuery_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(cache.Query))
})
return _c
}
func (_c *Cache_AddQuery_Call) Return(_a0 error) *Cache_AddQuery_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Cache_AddQuery_Call) RunAndReturn(run func(string, cache.Query) error) *Cache_AddQuery_Call {
_c.Call.Return(run)
return _c
}
// AddType provides a mock function with given fields: it
func (_m *Cache) AddType(it *pbresource.Type) {
_m.Called(it)
}
// Cache_AddType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddType'
type Cache_AddType_Call struct {
*mock.Call
}
// AddType is a helper method to define mock.On call
// - it *pbresource.Type
func (_e *Cache_Expecter) AddType(it interface{}) *Cache_AddType_Call {
return &Cache_AddType_Call{Call: _e.mock.On("AddType", it)}
}
func (_c *Cache_AddType_Call) Run(run func(it *pbresource.Type)) *Cache_AddType_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*pbresource.Type))
})
return _c
}
func (_c *Cache_AddType_Call) Return() *Cache_AddType_Call {
_c.Call.Return()
return _c
}
func (_c *Cache_AddType_Call) RunAndReturn(run func(*pbresource.Type)) *Cache_AddType_Call {
_c.Call.Return(run)
return _c
}
// Delete provides a mock function with given fields: r
func (_m *Cache) Delete(r *pbresource.Resource) error {
ret := _m.Called(r)
var r0 error
if rf, ok := ret.Get(0).(func(*pbresource.Resource) error); ok {
r0 = rf(r)
} else {
r0 = ret.Error(0)
}
return r0
}
// Cache_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
type Cache_Delete_Call struct {
*mock.Call
}
// Delete is a helper method to define mock.On call
// - r *pbresource.Resource
func (_e *Cache_Expecter) Delete(r interface{}) *Cache_Delete_Call {
return &Cache_Delete_Call{Call: _e.mock.On("Delete", r)}
}
func (_c *Cache_Delete_Call) Run(run func(r *pbresource.Resource)) *Cache_Delete_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*pbresource.Resource))
})
return _c
}
func (_c *Cache_Delete_Call) Return(_a0 error) *Cache_Delete_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Cache_Delete_Call) RunAndReturn(run func(*pbresource.Resource) error) *Cache_Delete_Call {
_c.Call.Return(run)
return _c
}
// Get provides a mock function with given fields: it, indexName, args
func (_m *Cache) 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
}
// Cache_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
type Cache_Get_Call struct {
*mock.Call
}
// Get is a helper method to define mock.On call
// - it *pbresource.Type
// - indexName string
// - args ...interface{}
func (_e *Cache_Expecter) Get(it interface{}, indexName interface{}, args ...interface{}) *Cache_Get_Call {
return &Cache_Get_Call{Call: _e.mock.On("Get",
append([]interface{}{it, indexName}, args...)...)}
}
func (_c *Cache_Get_Call) Run(run func(it *pbresource.Type, indexName string, args ...interface{})) *Cache_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 *Cache_Get_Call) Return(_a0 *pbresource.Resource, _a1 error) *Cache_Get_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Cache_Get_Call) RunAndReturn(run func(*pbresource.Type, string, ...interface{}) (*pbresource.Resource, error)) *Cache_Get_Call {
_c.Call.Return(run)
return _c
}
// Insert provides a mock function with given fields: r
func (_m *Cache) Insert(r *pbresource.Resource) error {
ret := _m.Called(r)
var r0 error
if rf, ok := ret.Get(0).(func(*pbresource.Resource) error); ok {
r0 = rf(r)
} else {
r0 = ret.Error(0)
}
return r0
}
// Cache_Insert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Insert'
type Cache_Insert_Call struct {
*mock.Call
}
// Insert is a helper method to define mock.On call
// - r *pbresource.Resource
func (_e *Cache_Expecter) Insert(r interface{}) *Cache_Insert_Call {
return &Cache_Insert_Call{Call: _e.mock.On("Insert", r)}
}
func (_c *Cache_Insert_Call) Run(run func(r *pbresource.Resource)) *Cache_Insert_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*pbresource.Resource))
})
return _c
}
func (_c *Cache_Insert_Call) Return(_a0 error) *Cache_Insert_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Cache_Insert_Call) RunAndReturn(run func(*pbresource.Resource) error) *Cache_Insert_Call {
_c.Call.Return(run)
return _c
}
// List provides a mock function with given fields: it, indexName, args
func (_m *Cache) 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
}
// Cache_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'
type Cache_List_Call struct {
*mock.Call
}
// List is a helper method to define mock.On call
// - it *pbresource.Type
// - indexName string
// - args ...interface{}
func (_e *Cache_Expecter) List(it interface{}, indexName interface{}, args ...interface{}) *Cache_List_Call {
return &Cache_List_Call{Call: _e.mock.On("List",
append([]interface{}{it, indexName}, args...)...)}
}
func (_c *Cache_List_Call) Run(run func(it *pbresource.Type, indexName string, args ...interface{})) *Cache_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 *Cache_List_Call) Return(_a0 []*pbresource.Resource, _a1 error) *Cache_List_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Cache_List_Call) RunAndReturn(run func(*pbresource.Type, string, ...interface{}) ([]*pbresource.Resource, error)) *Cache_List_Call {
_c.Call.Return(run)
return _c
}
// ListIterator provides a mock function with given fields: it, indexName, args
func (_m *Cache) 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
}
// Cache_ListIterator_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListIterator'
type Cache_ListIterator_Call struct {
*mock.Call
}
// ListIterator is a helper method to define mock.On call
// - it *pbresource.Type
// - indexName string
// - args ...interface{}
func (_e *Cache_Expecter) ListIterator(it interface{}, indexName interface{}, args ...interface{}) *Cache_ListIterator_Call {
return &Cache_ListIterator_Call{Call: _e.mock.On("ListIterator",
append([]interface{}{it, indexName}, args...)...)}
}
func (_c *Cache_ListIterator_Call) Run(run func(it *pbresource.Type, indexName string, args ...interface{})) *Cache_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 *Cache_ListIterator_Call) Return(_a0 cache.ResourceIterator, _a1 error) *Cache_ListIterator_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Cache_ListIterator_Call) RunAndReturn(run func(*pbresource.Type, string, ...interface{}) (cache.ResourceIterator, error)) *Cache_ListIterator_Call {
_c.Call.Return(run)
return _c
}
// Parents provides a mock function with given fields: it, indexName, args
func (_m *Cache) 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
}
// Cache_Parents_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Parents'
type Cache_Parents_Call struct {
*mock.Call
}
// Parents is a helper method to define mock.On call
// - it *pbresource.Type
// - indexName string
// - args ...interface{}
func (_e *Cache_Expecter) Parents(it interface{}, indexName interface{}, args ...interface{}) *Cache_Parents_Call {
return &Cache_Parents_Call{Call: _e.mock.On("Parents",
append([]interface{}{it, indexName}, args...)...)}
}
func (_c *Cache_Parents_Call) Run(run func(it *pbresource.Type, indexName string, args ...interface{})) *Cache_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 *Cache_Parents_Call) Return(_a0 []*pbresource.Resource, _a1 error) *Cache_Parents_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Cache_Parents_Call) RunAndReturn(run func(*pbresource.Type, string, ...interface{}) ([]*pbresource.Resource, error)) *Cache_Parents_Call {
_c.Call.Return(run)
return _c
}
// ParentsIterator provides a mock function with given fields: it, indexName, args
func (_m *Cache) 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
}
// Cache_ParentsIterator_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParentsIterator'
type Cache_ParentsIterator_Call struct {
*mock.Call
}
// ParentsIterator is a helper method to define mock.On call
// - it *pbresource.Type
// - indexName string
// - args ...interface{}
func (_e *Cache_Expecter) ParentsIterator(it interface{}, indexName interface{}, args ...interface{}) *Cache_ParentsIterator_Call {
return &Cache_ParentsIterator_Call{Call: _e.mock.On("ParentsIterator",
append([]interface{}{it, indexName}, args...)...)}
}
func (_c *Cache_ParentsIterator_Call) Run(run func(it *pbresource.Type, indexName string, args ...interface{})) *Cache_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 *Cache_ParentsIterator_Call) Return(_a0 cache.ResourceIterator, _a1 error) *Cache_ParentsIterator_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Cache_ParentsIterator_Call) RunAndReturn(run func(*pbresource.Type, string, ...interface{}) (cache.ResourceIterator, error)) *Cache_ParentsIterator_Call {
_c.Call.Return(run)
return _c
}
// Query provides a mock function with given fields: name, args
func (_m *Cache) 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
}
// Cache_Query_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Query'
type Cache_Query_Call struct {
*mock.Call
}
// Query is a helper method to define mock.On call
// - name string
// - args ...interface{}
func (_e *Cache_Expecter) Query(name interface{}, args ...interface{}) *Cache_Query_Call {
return &Cache_Query_Call{Call: _e.mock.On("Query",
append([]interface{}{name}, args...)...)}
}
func (_c *Cache_Query_Call) Run(run func(name string, args ...interface{})) *Cache_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 *Cache_Query_Call) Return(_a0 cache.ResourceIterator, _a1 error) *Cache_Query_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Cache_Query_Call) RunAndReturn(run func(string, ...interface{}) (cache.ResourceIterator, error)) *Cache_Query_Call {
_c.Call.Return(run)
return _c
}
// NewCache creates a new instance of Cache. 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 NewCache(t interface {
mock.TestingT
Cleanup(func())
}) *Cache {
mock := &Cache{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}