Documentation
¶
Index ¶
- type CommandResult
- type TestHelper
- func (h *TestHelper) AssertExitCode(result *CommandResult, expectedCode int, msgAndArgs ...interface{})
- func (h *TestHelper) AssertFailure(result *CommandResult, msgAndArgs ...interface{})
- func (h *TestHelper) AssertStderrContains(result *CommandResult, expected string, msgAndArgs ...interface{})
- func (h *TestHelper) AssertStderrNotContains(result *CommandResult, notExpected string, msgAndArgs ...interface{})
- func (h *TestHelper) AssertStdoutContains(result *CommandResult, expected string, msgAndArgs ...interface{})
- func (h *TestHelper) AssertStdoutNotContains(result *CommandResult, notExpected string, msgAndArgs ...interface{})
- func (h *TestHelper) AssertSuccess(result *CommandResult, msgAndArgs ...interface{})
- func (h *TestHelper) Cleanup()
- func (h *TestHelper) FileExists(filename string) bool
- func (h *TestHelper) GetWorkDir() string
- func (h *TestHelper) ReadFile(filename string) string
- func (h *TestHelper) RunCommand(args ...string) *CommandResult
- func (h *TestHelper) RunCommandWithEnv(env map[string]string, args ...string) *CommandResult
- func (h *TestHelper) SetTimeout(timeout time.Duration)
- func (h *TestHelper) WriteFile(filename string, content string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandResult ¶
type CommandResult struct {
Stdout string
Stderr string
ExitCode int
Duration time.Duration
Error error
}
CommandResult captures the result of a CLI command execution
type TestHelper ¶
type TestHelper struct {
// contains filtered or unexported fields
}
TestHelper provides utilities for E2E tests
func NewTestHelper ¶
func NewTestHelper(t *testing.T) *TestHelper
NewTestHelper creates a new test helper instance
func (*TestHelper) AssertExitCode ¶
func (h *TestHelper) AssertExitCode(result *CommandResult, expectedCode int, msgAndArgs ...interface{})
AssertExitCode asserts that the command exited with a specific code
func (*TestHelper) AssertFailure ¶
func (h *TestHelper) AssertFailure(result *CommandResult, msgAndArgs ...interface{})
AssertFailure asserts that the command failed (non-zero exit code)
func (*TestHelper) AssertStderrContains ¶
func (h *TestHelper) AssertStderrContains(result *CommandResult, expected string, msgAndArgs ...interface{})
AssertStderrContains asserts that stderr contains the expected string
func (*TestHelper) AssertStderrNotContains ¶
func (h *TestHelper) AssertStderrNotContains(result *CommandResult, notExpected string, msgAndArgs ...interface{})
AssertStderrNotContains asserts that stderr does not contain the string
func (*TestHelper) AssertStdoutContains ¶
func (h *TestHelper) AssertStdoutContains(result *CommandResult, expected string, msgAndArgs ...interface{})
AssertStdoutContains asserts that stdout contains the expected string
func (*TestHelper) AssertStdoutNotContains ¶
func (h *TestHelper) AssertStdoutNotContains(result *CommandResult, notExpected string, msgAndArgs ...interface{})
AssertStdoutNotContains asserts that stdout does not contain the string
func (*TestHelper) AssertSuccess ¶
func (h *TestHelper) AssertSuccess(result *CommandResult, msgAndArgs ...interface{})
AssertSuccess asserts that the command succeeded (exit code 0)
func (*TestHelper) Cleanup ¶
func (h *TestHelper) Cleanup()
Cleanup removes test artifacts and temporary files
func (*TestHelper) FileExists ¶
func (h *TestHelper) FileExists(filename string) bool
FileExists checks if a file exists in the work directory
func (*TestHelper) GetWorkDir ¶
func (h *TestHelper) GetWorkDir() string
GetWorkDir returns the temporary working directory
func (*TestHelper) ReadFile ¶
func (h *TestHelper) ReadFile(filename string) string
ReadFile reads content from a file in the work directory
func (*TestHelper) RunCommand ¶
func (h *TestHelper) RunCommand(args ...string) *CommandResult
RunCommand executes a CLI command and returns the result
func (*TestHelper) RunCommandWithEnv ¶
func (h *TestHelper) RunCommandWithEnv(env map[string]string, args ...string) *CommandResult
RunCommandWithEnv executes a CLI command with custom environment variables
func (*TestHelper) SetTimeout ¶
func (h *TestHelper) SetTimeout(timeout time.Duration)
SetTimeout sets the default timeout for commands
func (*TestHelper) WriteFile ¶
func (h *TestHelper) WriteFile(filename string, content string)
WriteFile writes content to a file in the work directory