Documentation
¶
Index ¶
- func CreateTestAgent(namespace, name string) *v1alpha2.Agent
- func CreateTestDir(t *testing.T, fs afero.Fs, path string)
- func CreateTestFile(t *testing.T, fs afero.Fs, path, content string)
- func CreateTestNamespace(name string) *corev1.Namespace
- func CreateTestSecret(namespace, name string, data map[string]string) *corev1.Secret
- func FileExists(t *testing.T, fs afero.Fs, path string) bool
- func IsDockerAvailable() bool
- func IsKindAvailable() bool
- func MockAgentResponse(agents []api.AgentResponse) http.HandlerFunc
- func MockErrorResponse(statusCode int, message string) http.HandlerFunc
- func MockSessionResponse(sessions []*api.Session) http.HandlerFunc
- func MockVersionResponse(version string) http.HandlerFunc
- func NewFakeControllerClient(t *testing.T, objects ...client.Object) client.Client
- func NewFakeK8sClientset(objects ...runtime.Object) *fake.Clientset
- func NewMemFS() afero.Fs
- func NewMockHTTPServer(t *testing.T, handler http.HandlerFunc) *httptest.Server
- func ReadTestFile(t *testing.T, fs afero.Fs, path string) string
- func RequireDocker(t *testing.T)
- func RequireKind(t *testing.T)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTestAgent ¶
CreateTestAgent creates a test Agent resource for testing.
func CreateTestDir ¶
CreateTestDir creates a directory in the filesystem for testing.
func CreateTestFile ¶
CreateTestFile writes a file to the filesystem for testing.
func CreateTestNamespace ¶
CreateTestNamespace creates a test Namespace resource for testing.
func CreateTestSecret ¶
CreateTestSecret creates a test Secret resource for testing.
func FileExists ¶
FileExists checks if a file exists in the filesystem.
func IsDockerAvailable ¶
func IsDockerAvailable() bool
IsDockerAvailable returns true if Docker daemon is available.
func IsKindAvailable ¶
func IsKindAvailable() bool
IsKindAvailable returns true if kind is available.
func MockAgentResponse ¶
func MockAgentResponse(agents []api.AgentResponse) http.HandlerFunc
MockAgentResponse returns a mock AgentResponse handler.
func MockErrorResponse ¶
func MockErrorResponse(statusCode int, message string) http.HandlerFunc
MockErrorResponse returns a mock error response handler.
func MockSessionResponse ¶
func MockSessionResponse(sessions []*api.Session) http.HandlerFunc
MockSessionResponse returns a mock SessionResponse handler.
func MockVersionResponse ¶
func MockVersionResponse(version string) http.HandlerFunc
MockVersionResponse returns a mock version response handler.
func NewFakeControllerClient ¶
NewFakeControllerClient creates a fake controller-runtime client with the kagent scheme. Useful for testing reconcilers and CRD interactions.
func NewFakeK8sClientset ¶
NewFakeK8sClientset creates a fake Kubernetes clientset with optional initial objects. Useful for testing kubectl/client-go interactions.
func NewMemFS ¶
NewMemFS creates an in-memory filesystem for testing. This allows tests to run without touching the actual filesystem.
func NewMockHTTPServer ¶
NewMockHTTPServer creates a test HTTP server for mocking API responses.
func ReadTestFile ¶
ReadTestFile reads a file from the filesystem for testing assertions.
func RequireDocker ¶
RequireDocker skips the test if Docker is not available. Use this for integration tests that require Docker daemon.
func RequireKind ¶
RequireKind skips the test if kind is not available. Use this for integration tests that require kind cluster.
Types ¶
This section is empty.