testmocks

package
v0.0.0-...-23e29b4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockClusterManager

type MockClusterManager struct {
	mock.Mock
	// contains filtered or unexported fields
}

MockClusterManager implements the ClusterManager interface for testing

func NewMockClusterManager

func NewMockClusterManager() *MockClusterManager

NewMockClusterManager initializes with defaults similar to the real implementation

func (*MockClusterManager) GetClient

func (m *MockClusterManager) GetClient(clusterName string) (kubernetes.Interface, error)

func (*MockClusterManager) GetCurrentClient

func (m *MockClusterManager) GetCurrentClient() (kubernetes.Interface, error)

func (*MockClusterManager) GetCurrentContext

func (m *MockClusterManager) GetCurrentContext() string

func (*MockClusterManager) GetCurrentDynamicClient

func (m *MockClusterManager) GetCurrentDynamicClient() (dynamic.Interface, error)

func (*MockClusterManager) GetCurrentNamespace

func (m *MockClusterManager) GetCurrentNamespace() string

func (*MockClusterManager) GetDynamicClient

func (m *MockClusterManager) GetDynamicClient(clusterName string) (dynamic.Interface, error)

func (*MockClusterManager) ListClusters

func (m *MockClusterManager) ListClusters() []string

func (*MockClusterManager) LoadKubeConfig

func (m *MockClusterManager) LoadKubeConfig(name, path string) error

func (*MockClusterManager) SetCurrentContext

func (m *MockClusterManager) SetCurrentContext(contextName string) error

func (*MockClusterManager) SetCurrentNamespace

func (m *MockClusterManager) SetCurrentNamespace(namespace string)

type MockDeployment

type MockDeployment struct {
	mock.Mock
	Name             string
	Namespace        string
	Image            string
	Replicas         float64
	Labels           map[string]interface{}
	ContainerPort    string
	Env              map[string]interface{}
	ImagePullPolicy  string
	ImagePullSecrets []interface{}
}

MockDeployment implements the kai.DeploymentOperator interface

func NewMockDeployment

func NewMockDeployment(params kai.DeploymentParams) *MockDeployment

NewMockDeployment creates a new MockDeployment

func (*MockDeployment) Create

Create mocks the Create method

func (*MockDeployment) List

func (m *MockDeployment) List(ctx context.Context, cm kai.ClusterManager, allNamespaces bool, labelSelector string) (string, error)

List mocks the List method

type MockDeploymentFactory

type MockDeploymentFactory struct {
	mock.Mock
}

MockDeploymentFactory implements the tools.DeploymentFactory interface

func NewMockDeploymentFactory

func NewMockDeploymentFactory() *MockDeploymentFactory

NewMockDeploymentFactory creates a new MockDeploymentFactory

func (*MockDeploymentFactory) NewDeployment

NewDeployment returns a mocked DeploymentOperator

type MockPod

type MockPod struct {
	mock.Mock
	Name               string
	Namespace          string
	Image              string
	Command            []interface{}
	Args               []interface{}
	Labels             map[string]interface{}
	ContainerName      string
	ContainerPort      string
	Env                map[string]interface{}
	ImagePullPolicy    string
	ImagePullSecrets   []interface{}
	RestartPolicy      string
	NodeSelector       map[string]interface{}
	ServiceAccountName string
	Volumes            []interface{}
	VolumeMounts       []interface{}
}

MockPod implements the PodOperator interface for testing

func NewMockPod

func NewMockPod(params kai.PodParams) *MockPod

NewMockPod creates a new MockPod instance

func (*MockPod) Create

func (m *MockPod) Create(ctx context.Context, cm kai.ClusterManager) (string, error)

Create mocks the Create method

func (*MockPod) Delete

func (m *MockPod) Delete(ctx context.Context, cm kai.ClusterManager, force bool) (string, error)

Delete mocks the Delete method

func (*MockPod) Get

func (m *MockPod) Get(ctx context.Context, cm kai.ClusterManager) (string, error)

Get mocks the Get method

func (*MockPod) List

func (m *MockPod) List(ctx context.Context, cm kai.ClusterManager, limit int64, labelSelector, fieldSelector string) (string, error)

List mocks the List method

func (*MockPod) StreamLogs

func (m *MockPod) StreamLogs(ctx context.Context, cm kai.ClusterManager, tailLines int64, previous bool, since *time.Duration) (string, error)

StreamLogs mocks the StreamLogs method

type MockPodFactory

type MockPodFactory struct {
	mock.Mock
}

MockPodFactory implements the PodFactory interface for testing

func (*MockPodFactory) NewPod

func (m *MockPodFactory) NewPod(params kai.PodParams) kai.PodOperator

NewPod returns a mocked PodOperator

type MockServer

type MockServer struct {
	mock.Mock
}

MockServer to check that each respective tool is registered correctly

func (*MockServer) AddTool

func (m *MockServer) AddTool(tool mcp.Tool, handler server.ToolHandlerFunc)

func (*MockServer) Serve

func (m *MockServer) Serve() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL