1
0
mirror of https://github.com/rancher/steve.git synced 2025-07-14 15:14:44 +00:00
steve/pkg/stores/sqlproxy/proxy_mocks_test.go
Silvio Moioli 3350323f91
sql: propagate and use contexts (#465)
Previous SQLite-related code used context.Background() and context.TODO() because it was not developed with context awareness.

This commit propagates the main Steve context so that it can be used when interacting with SQL context-aware functions.

This PR removes all production-code use of context.Background() and context.TODO() and replaces test-code use of TODO with Background.

Contributes to rancher/rancher#47825
2025-02-12 09:46:10 +01:00

404 lines
16 KiB
Go

// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/rancher/steve/pkg/stores/sqlproxy (interfaces: Cache,ClientGetter,CacheFactory,SchemaColumnSetter,RelationshipNotifier,TransformBuilder)
//
// Generated by this command:
//
// mockgen --build_flags=--mod=mod -package sqlproxy -destination ./proxy_mocks_test.go github.com/rancher/steve/pkg/stores/sqlproxy Cache,ClientGetter,CacheFactory,SchemaColumnSetter,RelationshipNotifier,TransformBuilder
//
// Package sqlproxy is a generated GoMock package.
package sqlproxy
import (
context "context"
reflect "reflect"
types "github.com/rancher/apiserver/pkg/types"
informer "github.com/rancher/steve/pkg/sqlcache/informer"
factory "github.com/rancher/steve/pkg/sqlcache/informer/factory"
partition "github.com/rancher/steve/pkg/sqlcache/partition"
summary "github.com/rancher/wrangler/v3/pkg/summary"
gomock "go.uber.org/mock/gomock"
unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
schema "k8s.io/apimachinery/pkg/runtime/schema"
dynamic "k8s.io/client-go/dynamic"
kubernetes "k8s.io/client-go/kubernetes"
rest "k8s.io/client-go/rest"
cache "k8s.io/client-go/tools/cache"
)
// MockCache is a mock of Cache interface.
type MockCache struct {
ctrl *gomock.Controller
recorder *MockCacheMockRecorder
}
// MockCacheMockRecorder is the mock recorder for MockCache.
type MockCacheMockRecorder struct {
mock *MockCache
}
// NewMockCache creates a new mock instance.
func NewMockCache(ctrl *gomock.Controller) *MockCache {
mock := &MockCache{ctrl: ctrl}
mock.recorder = &MockCacheMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockCache) EXPECT() *MockCacheMockRecorder {
return m.recorder
}
// ListByOptions mocks base method.
func (m *MockCache) ListByOptions(arg0 context.Context, arg1 informer.ListOptions, arg2 []partition.Partition, arg3 string) (*unstructured.UnstructuredList, int, string, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListByOptions", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(*unstructured.UnstructuredList)
ret1, _ := ret[1].(int)
ret2, _ := ret[2].(string)
ret3, _ := ret[3].(error)
return ret0, ret1, ret2, ret3
}
// ListByOptions indicates an expected call of ListByOptions.
func (mr *MockCacheMockRecorder) ListByOptions(arg0, arg1, arg2, arg3 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListByOptions", reflect.TypeOf((*MockCache)(nil).ListByOptions), arg0, arg1, arg2, arg3)
}
// MockClientGetter is a mock of ClientGetter interface.
type MockClientGetter struct {
ctrl *gomock.Controller
recorder *MockClientGetterMockRecorder
}
// MockClientGetterMockRecorder is the mock recorder for MockClientGetter.
type MockClientGetterMockRecorder struct {
mock *MockClientGetter
}
// NewMockClientGetter creates a new mock instance.
func NewMockClientGetter(ctrl *gomock.Controller) *MockClientGetter {
mock := &MockClientGetter{ctrl: ctrl}
mock.recorder = &MockClientGetterMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockClientGetter) EXPECT() *MockClientGetterMockRecorder {
return m.recorder
}
// AdminClient mocks base method.
func (m *MockClientGetter) AdminClient(arg0 *types.APIRequest, arg1 *types.APISchema, arg2 string, arg3 rest.WarningHandler) (dynamic.ResourceInterface, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AdminClient", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(dynamic.ResourceInterface)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// AdminClient indicates an expected call of AdminClient.
func (mr *MockClientGetterMockRecorder) AdminClient(arg0, arg1, arg2, arg3 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AdminClient", reflect.TypeOf((*MockClientGetter)(nil).AdminClient), arg0, arg1, arg2, arg3)
}
// AdminK8sInterface mocks base method.
func (m *MockClientGetter) AdminK8sInterface() (kubernetes.Interface, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AdminK8sInterface")
ret0, _ := ret[0].(kubernetes.Interface)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// AdminK8sInterface indicates an expected call of AdminK8sInterface.
func (mr *MockClientGetterMockRecorder) AdminK8sInterface() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AdminK8sInterface", reflect.TypeOf((*MockClientGetter)(nil).AdminK8sInterface))
}
// Client mocks base method.
func (m *MockClientGetter) Client(arg0 *types.APIRequest, arg1 *types.APISchema, arg2 string, arg3 rest.WarningHandler) (dynamic.ResourceInterface, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Client", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(dynamic.ResourceInterface)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Client indicates an expected call of Client.
func (mr *MockClientGetterMockRecorder) Client(arg0, arg1, arg2, arg3 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Client", reflect.TypeOf((*MockClientGetter)(nil).Client), arg0, arg1, arg2, arg3)
}
// DynamicClient mocks base method.
func (m *MockClientGetter) DynamicClient(arg0 *types.APIRequest, arg1 rest.WarningHandler) (dynamic.Interface, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DynamicClient", arg0, arg1)
ret0, _ := ret[0].(dynamic.Interface)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// DynamicClient indicates an expected call of DynamicClient.
func (mr *MockClientGetterMockRecorder) DynamicClient(arg0, arg1 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DynamicClient", reflect.TypeOf((*MockClientGetter)(nil).DynamicClient), arg0, arg1)
}
// IsImpersonating mocks base method.
func (m *MockClientGetter) IsImpersonating() bool {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "IsImpersonating")
ret0, _ := ret[0].(bool)
return ret0
}
// IsImpersonating indicates an expected call of IsImpersonating.
func (mr *MockClientGetterMockRecorder) IsImpersonating() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsImpersonating", reflect.TypeOf((*MockClientGetter)(nil).IsImpersonating))
}
// K8sInterface mocks base method.
func (m *MockClientGetter) K8sInterface(arg0 *types.APIRequest) (kubernetes.Interface, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "K8sInterface", arg0)
ret0, _ := ret[0].(kubernetes.Interface)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// K8sInterface indicates an expected call of K8sInterface.
func (mr *MockClientGetterMockRecorder) K8sInterface(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "K8sInterface", reflect.TypeOf((*MockClientGetter)(nil).K8sInterface), arg0)
}
// TableAdminClient mocks base method.
func (m *MockClientGetter) TableAdminClient(arg0 *types.APIRequest, arg1 *types.APISchema, arg2 string, arg3 rest.WarningHandler) (dynamic.ResourceInterface, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "TableAdminClient", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(dynamic.ResourceInterface)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// TableAdminClient indicates an expected call of TableAdminClient.
func (mr *MockClientGetterMockRecorder) TableAdminClient(arg0, arg1, arg2, arg3 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TableAdminClient", reflect.TypeOf((*MockClientGetter)(nil).TableAdminClient), arg0, arg1, arg2, arg3)
}
// TableAdminClientForWatch mocks base method.
func (m *MockClientGetter) TableAdminClientForWatch(arg0 *types.APIRequest, arg1 *types.APISchema, arg2 string, arg3 rest.WarningHandler) (dynamic.ResourceInterface, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "TableAdminClientForWatch", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(dynamic.ResourceInterface)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// TableAdminClientForWatch indicates an expected call of TableAdminClientForWatch.
func (mr *MockClientGetterMockRecorder) TableAdminClientForWatch(arg0, arg1, arg2, arg3 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TableAdminClientForWatch", reflect.TypeOf((*MockClientGetter)(nil).TableAdminClientForWatch), arg0, arg1, arg2, arg3)
}
// TableClient mocks base method.
func (m *MockClientGetter) TableClient(arg0 *types.APIRequest, arg1 *types.APISchema, arg2 string, arg3 rest.WarningHandler) (dynamic.ResourceInterface, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "TableClient", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(dynamic.ResourceInterface)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// TableClient indicates an expected call of TableClient.
func (mr *MockClientGetterMockRecorder) TableClient(arg0, arg1, arg2, arg3 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TableClient", reflect.TypeOf((*MockClientGetter)(nil).TableClient), arg0, arg1, arg2, arg3)
}
// TableClientForWatch mocks base method.
func (m *MockClientGetter) TableClientForWatch(arg0 *types.APIRequest, arg1 *types.APISchema, arg2 string, arg3 rest.WarningHandler) (dynamic.ResourceInterface, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "TableClientForWatch", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(dynamic.ResourceInterface)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// TableClientForWatch indicates an expected call of TableClientForWatch.
func (mr *MockClientGetterMockRecorder) TableClientForWatch(arg0, arg1, arg2, arg3 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TableClientForWatch", reflect.TypeOf((*MockClientGetter)(nil).TableClientForWatch), arg0, arg1, arg2, arg3)
}
// MockCacheFactory is a mock of CacheFactory interface.
type MockCacheFactory struct {
ctrl *gomock.Controller
recorder *MockCacheFactoryMockRecorder
}
// MockCacheFactoryMockRecorder is the mock recorder for MockCacheFactory.
type MockCacheFactoryMockRecorder struct {
mock *MockCacheFactory
}
// NewMockCacheFactory creates a new mock instance.
func NewMockCacheFactory(ctrl *gomock.Controller) *MockCacheFactory {
mock := &MockCacheFactory{ctrl: ctrl}
mock.recorder = &MockCacheFactoryMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockCacheFactory) EXPECT() *MockCacheFactoryMockRecorder {
return m.recorder
}
// CacheFor mocks base method.
func (m *MockCacheFactory) CacheFor(arg0 context.Context, arg1 [][]string, arg2 cache.TransformFunc, arg3 dynamic.ResourceInterface, arg4 schema.GroupVersionKind, arg5, arg6 bool) (factory.Cache, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CacheFor", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
ret0, _ := ret[0].(factory.Cache)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// CacheFor indicates an expected call of CacheFor.
func (mr *MockCacheFactoryMockRecorder) CacheFor(arg0, arg1, arg2, arg3, arg4, arg5, arg6 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CacheFor", reflect.TypeOf((*MockCacheFactory)(nil).CacheFor), arg0, arg1, arg2, arg3, arg4, arg5, arg6)
}
// Reset mocks base method.
func (m *MockCacheFactory) Reset() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Reset")
ret0, _ := ret[0].(error)
return ret0
}
// Reset indicates an expected call of Reset.
func (mr *MockCacheFactoryMockRecorder) Reset() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reset", reflect.TypeOf((*MockCacheFactory)(nil).Reset))
}
// MockSchemaColumnSetter is a mock of SchemaColumnSetter interface.
type MockSchemaColumnSetter struct {
ctrl *gomock.Controller
recorder *MockSchemaColumnSetterMockRecorder
}
// MockSchemaColumnSetterMockRecorder is the mock recorder for MockSchemaColumnSetter.
type MockSchemaColumnSetterMockRecorder struct {
mock *MockSchemaColumnSetter
}
// NewMockSchemaColumnSetter creates a new mock instance.
func NewMockSchemaColumnSetter(ctrl *gomock.Controller) *MockSchemaColumnSetter {
mock := &MockSchemaColumnSetter{ctrl: ctrl}
mock.recorder = &MockSchemaColumnSetterMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockSchemaColumnSetter) EXPECT() *MockSchemaColumnSetterMockRecorder {
return m.recorder
}
// SetColumns mocks base method.
func (m *MockSchemaColumnSetter) SetColumns(arg0 context.Context, arg1 *types.APISchema) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetColumns", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}
// SetColumns indicates an expected call of SetColumns.
func (mr *MockSchemaColumnSetterMockRecorder) SetColumns(arg0, arg1 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetColumns", reflect.TypeOf((*MockSchemaColumnSetter)(nil).SetColumns), arg0, arg1)
}
// MockRelationshipNotifier is a mock of RelationshipNotifier interface.
type MockRelationshipNotifier struct {
ctrl *gomock.Controller
recorder *MockRelationshipNotifierMockRecorder
}
// MockRelationshipNotifierMockRecorder is the mock recorder for MockRelationshipNotifier.
type MockRelationshipNotifierMockRecorder struct {
mock *MockRelationshipNotifier
}
// NewMockRelationshipNotifier creates a new mock instance.
func NewMockRelationshipNotifier(ctrl *gomock.Controller) *MockRelationshipNotifier {
mock := &MockRelationshipNotifier{ctrl: ctrl}
mock.recorder = &MockRelationshipNotifierMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockRelationshipNotifier) EXPECT() *MockRelationshipNotifierMockRecorder {
return m.recorder
}
// OnInboundRelationshipChange mocks base method.
func (m *MockRelationshipNotifier) OnInboundRelationshipChange(arg0 context.Context, arg1 *types.APISchema, arg2 string) <-chan *summary.Relationship {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "OnInboundRelationshipChange", arg0, arg1, arg2)
ret0, _ := ret[0].(<-chan *summary.Relationship)
return ret0
}
// OnInboundRelationshipChange indicates an expected call of OnInboundRelationshipChange.
func (mr *MockRelationshipNotifierMockRecorder) OnInboundRelationshipChange(arg0, arg1, arg2 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnInboundRelationshipChange", reflect.TypeOf((*MockRelationshipNotifier)(nil).OnInboundRelationshipChange), arg0, arg1, arg2)
}
// MockTransformBuilder is a mock of TransformBuilder interface.
type MockTransformBuilder struct {
ctrl *gomock.Controller
recorder *MockTransformBuilderMockRecorder
}
// MockTransformBuilderMockRecorder is the mock recorder for MockTransformBuilder.
type MockTransformBuilderMockRecorder struct {
mock *MockTransformBuilder
}
// NewMockTransformBuilder creates a new mock instance.
func NewMockTransformBuilder(ctrl *gomock.Controller) *MockTransformBuilder {
mock := &MockTransformBuilder{ctrl: ctrl}
mock.recorder = &MockTransformBuilderMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockTransformBuilder) EXPECT() *MockTransformBuilderMockRecorder {
return m.recorder
}
// GetTransformFunc mocks base method.
func (m *MockTransformBuilder) GetTransformFunc(arg0 schema.GroupVersionKind) cache.TransformFunc {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetTransformFunc", arg0)
ret0, _ := ret[0].(cache.TransformFunc)
return ret0
}
// GetTransformFunc indicates an expected call of GetTransformFunc.
func (mr *MockTransformBuilderMockRecorder) GetTransformFunc(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTransformFunc", reflect.TypeOf((*MockTransformBuilder)(nil).GetTransformFunc), arg0)
}