k9s

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package k9s provides a k9s client implementation.

Coverage Note: The DefaultK9sExecutor.Execute() method (line 20) and parts of the HandleConnectRunE execution path cannot be fully tested in unit tests because they require launching k9s which needs an actual terminal UI. These paths are validated through: - Integration testing with actual k9s installation - Manual verification of the connect command - Mock-based testing of all logic leading up to k9s execution

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps k9s command functionality.

func NewClient

func NewClient() *Client

NewClient creates a new k9s client instance with the default executor.

func NewClientWithExecutor

func NewClientWithExecutor(executor Executor) *Client

NewClientWithExecutor creates a new k9s client with a custom executor for testing.

func (*Client) CreateConnectCommand

func (c *Client) CreateConnectCommand(kubeConfigPath, context string) *cobra.Command

CreateConnectCommand creates a k9s command with all its flags and behavior.

type DefaultK9sExecutor

type DefaultK9sExecutor struct{}

DefaultK9sExecutor is the default implementation that calls k9s directly.

func (*DefaultK9sExecutor) Execute

func (e *DefaultK9sExecutor) Execute()

Execute calls the k9s cmd.Execute function.

type Executor

type Executor interface {
	Execute()
}

Executor defines the interface for executing k9s.

type MockExecutor added in v1.14.0

type MockExecutor struct {
	mock.Mock
}

MockExecutor is an autogenerated mock type for the Executor type

func NewMockExecutor added in v1.14.0

func NewMockExecutor(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockExecutor

NewMockExecutor creates a new instance of MockExecutor. 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 (*MockExecutor) EXPECT added in v1.14.0

func (_m *MockExecutor) EXPECT() *MockExecutor_Expecter

func (*MockExecutor) Execute added in v1.14.0

func (_mock *MockExecutor) Execute()

Execute provides a mock function for the type MockExecutor

type MockExecutor_Execute_Call added in v1.14.0

type MockExecutor_Execute_Call struct {
	*mock.Call
}

MockExecutor_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'

func (*MockExecutor_Execute_Call) Return added in v1.14.0

func (*MockExecutor_Execute_Call) Run added in v1.14.0

func (*MockExecutor_Execute_Call) RunAndReturn added in v1.14.0

func (_c *MockExecutor_Execute_Call) RunAndReturn(run func()) *MockExecutor_Execute_Call

type MockExecutor_Expecter added in v1.14.0

type MockExecutor_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockExecutor_Expecter) Execute added in v1.14.0

Execute is a helper method to define mock.On call

Jump to

Keyboard shortcuts

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