Documentation
¶
Index ¶
- Constants
- Variables
- func CheckDockerAvailable() error
- func CheckPortsAvailable() error
- func DefaultCoverageConfig() *coverage.CoverageConfig
- type CoverageCollector
- type GatewayTestsConfig
- type InfrastructureConfig
- type InfrastructureID
- type InfrastructureManager
- type TestConfig
- type TestDefinition
- type TestReporter
- func (r *TestReporter) EndTest(state *TestState, passed bool, errorMsg string)
- func (r *TestReporter) GetResults() []TestResult
- func (r *TestReporter) HasFailures() bool
- func (r *TestReporter) LogAction(action string)
- func (r *TestReporter) LogInfo(message string)
- func (r *TestReporter) LogPhase1(component, message string)
- func (r *TestReporter) LogPhase1Detail(detail string)
- func (r *TestReporter) LogPhase1Fail(component, message, details string)
- func (r *TestReporter) LogPhase1Pass(component, message string)
- func (r *TestReporter) LogSuccess(message string)
- func (r *TestReporter) LogTest(testID, testName string, passed bool, logFile string)
- func (r *TestReporter) LogWaiting(message string)
- func (r *TestReporter) PrintSummary()
- func (r *TestReporter) Setup() error
- func (r *TestReporter) SkipTest(testID, testName, reason string)
- func (r *TestReporter) StartTest(testID, testName string)
- type TestResult
- type TestState
- func (s *TestState) Cleanup()
- func (s *TestState) ExecuteCLI(args ...string) error
- func (s *TestState) GetCombinedOutput() string
- func (s *TestState) GetConfigDir() string
- func (s *TestState) GetDuration() time.Duration
- func (s *TestState) GetExitCode() int
- func (s *TestState) GetStderr() string
- func (s *TestState) GetStdout() string
- func (s *TestState) Reset() error
- func (s *TestState) SetAPIInfo(name, version string)
- func (s *TestState) SetCLIBinaryPath(path string)
- func (s *TestState) SetCLICoverDir(dir string)
- func (s *TestState) SetGatewayInfo(name, server string)
- func (s *TestState) SetMCPInfo(name, version string)
- func (s *TestState) SetTestInfo(testID, testName string)
- type TestsConfig
Constants ¶
const ( ColorReset = "\033[0m" ColorRed = "\033[31m" ColorGreen = "\033[32m" ColorYellow = "\033[33m" ColorBlue = "\033[34m" ColorPurple = "\033[35m" ColorCyan = "\033[36m" ColorGray = "\033[90m" ColorBold = "\033[1m" )
ANSI color codes
const ( // DefaultStartupTimeout is the maximum time to wait for services to become healthy DefaultStartupTimeout = 120 * time.Second // HealthCheckInterval is how often to check service health HealthCheckInterval = 5 * time.Second // GatewayControllerPort is the REST API (management) port for gateway-controller GatewayControllerPort = "9090" // GatewayControllerAdminPort is the admin (health / config_dump) port for gateway-controller GatewayControllerAdminPort = "9092" // GatewayAdminBasePath is the URL prefix under which the gateway-controller admin API // is served. It must stay in sync with the controller admin OpenAPI spec. GatewayAdminBasePath = "/api/admin/v0.9" // MCPServerPort is the port for MCP server MCPServerPort = "3001" )
Variables ¶
var NewCoverageCollector = coverage.NewCoverageCollector
NewCoverageCollector creates a new CoverageCollector
Functions ¶
func CheckDockerAvailable ¶
func CheckDockerAvailable() error
CheckDockerAvailable verifies Docker is running
func CheckPortsAvailable ¶
func CheckPortsAvailable() error
CheckPortsAvailable verifies required ports are free
func DefaultCoverageConfig ¶
func DefaultCoverageConfig() *coverage.CoverageConfig
DefaultCoverageConfig returns the default coverage configuration for cli/it
Types ¶
type CoverageCollector ¶
type CoverageCollector = coverage.CoverageCollector
CoverageCollector is an alias to the common coverage collector
type GatewayTestsConfig ¶
type GatewayTestsConfig struct {
Manage []TestDefinition `yaml:"manage"`
Apply []TestDefinition `yaml:"apply"`
API []TestDefinition `yaml:"api"`
MCP []TestDefinition `yaml:"mcp"`
Build []TestDefinition `yaml:"build"`
}
GatewayTestsConfig holds gateway-related test configurations
type InfrastructureConfig ¶
type InfrastructureConfig struct {
ComposeFile string `yaml:"compose_file"`
StartupTimeout string `yaml:"startup_timeout"`
HealthCheckInterval string `yaml:"health_check_interval"`
DockerRegistry string `yaml:"docker_registry"`
ImageTag string `yaml:"image_tag"`
}
InfrastructureConfig holds infrastructure-related configuration
type InfrastructureID ¶
type InfrastructureID string
InfrastructureID represents infrastructure component identifiers
const ( // InfraCLI represents the CLI binary InfraCLI InfrastructureID = "CLI" // InfraGateway represents the gateway stack (running containers) InfraGateway InfrastructureID = "GATEWAY" // InfraMCPServer represents the MCP server InfraMCPServer InfrastructureID = "MCP_SERVER" )
type InfrastructureManager ¶
type InfrastructureManager struct {
// contains filtered or unexported fields
}
InfrastructureManager manages the lifecycle of test infrastructure
func NewInfrastructureManager ¶
func NewInfrastructureManager(reporter *TestReporter, cfg *TestConfig, cfgPath string) *InfrastructureManager
func (*InfrastructureManager) GetCLIBinaryPath ¶
func (m *InfrastructureManager) GetCLIBinaryPath() string
GetCLIBinaryPath returns the path to the CLI binary
func (*InfrastructureManager) SetupInfrastructure ¶
func (m *InfrastructureManager) SetupInfrastructure(required []InfrastructureID) error
SetupInfrastructure starts the required infrastructure components
func (*InfrastructureManager) Teardown ¶
func (m *InfrastructureManager) Teardown() error
Teardown stops all infrastructure components
type TestConfig ¶
type TestConfig struct {
Infrastructure InfrastructureConfig `yaml:"infrastructure"`
Tests TestsConfig `yaml:"tests"`
}
TestConfig represents the test configuration file structure
func LoadTestConfig ¶
func LoadTestConfig(path string) (*TestConfig, error)
LoadTestConfig loads the test configuration from a YAML file
func (*TestConfig) GetAllTests ¶
func (c *TestConfig) GetAllTests() []TestDefinition
GetAllTests returns all test definitions regardless of enabled status
func (*TestConfig) GetEnabledTests ¶
func (c *TestConfig) GetEnabledTests() []TestDefinition
GetEnabledTests returns all enabled test definitions
func (*TestConfig) GetRequiredInfrastructure ¶
func (c *TestConfig) GetRequiredInfrastructure() []InfrastructureID
GetRequiredInfrastructure returns unique infrastructure IDs required by enabled tests
func (*TestConfig) GetTestByID ¶
func (c *TestConfig) GetTestByID(testID string) *TestDefinition
GetTestByID returns the test definition for a given ID
func (*TestConfig) IsTestEnabled ¶
func (c *TestConfig) IsTestEnabled(testID string) bool
IsTestEnabled checks if a test with the given ID is enabled
type TestDefinition ¶
type TestDefinition struct {
ID string `yaml:"id"`
Name string `yaml:"name"`
Enabled bool `yaml:"enabled"`
Requires []string `yaml:"requires"`
}
TestDefinition represents a single test definition
type TestReporter ¶
type TestReporter struct {
// contains filtered or unexported fields
}
TestReporter handles test logging and reporting
func NewTestReporter ¶
func NewTestReporter(logsDir string) *TestReporter
NewTestReporter creates a new test reporter
func (*TestReporter) EndTest ¶
func (r *TestReporter) EndTest(state *TestState, passed bool, errorMsg string)
EndTest completes the current test and writes the log file
func (*TestReporter) GetResults ¶
func (r *TestReporter) GetResults() []TestResult
GetResults returns all test results
func (*TestReporter) HasFailures ¶
func (r *TestReporter) HasFailures() bool
HasFailures returns true if any tests failed
func (*TestReporter) LogAction ¶
func (r *TestReporter) LogAction(action string)
LogAction logs an action being performed
func (*TestReporter) LogInfo ¶
func (r *TestReporter) LogInfo(message string)
LogInfo logs an info message
func (*TestReporter) LogPhase1 ¶
func (r *TestReporter) LogPhase1(component, message string)
LogPhase1 logs a Phase 1 infrastructure message
func (*TestReporter) LogPhase1Detail ¶
func (r *TestReporter) LogPhase1Detail(detail string)
LogPhase1Detail logs a detailed Phase 1 step (indented)
func (*TestReporter) LogPhase1Fail ¶
func (r *TestReporter) LogPhase1Fail(component, message, details string)
LogPhase1Fail logs a Phase 1 failure
func (*TestReporter) LogPhase1Pass ¶
func (r *TestReporter) LogPhase1Pass(component, message string)
LogPhase1Pass logs a Phase 1 success
func (*TestReporter) LogSuccess ¶
func (r *TestReporter) LogSuccess(message string)
LogSuccess logs a success message
func (*TestReporter) LogTest ¶
func (r *TestReporter) LogTest(testID, testName string, passed bool, logFile string)
LogTest logs a test result (called after test completion)
func (*TestReporter) LogWaiting ¶
func (r *TestReporter) LogWaiting(message string)
LogWaiting logs a waiting/progress message with spinner
func (*TestReporter) PrintSummary ¶
func (r *TestReporter) PrintSummary()
PrintSummary prints the test summary with results table
func (*TestReporter) Setup ¶
func (r *TestReporter) Setup() error
Setup initializes the reporter and creates the logs directory
func (*TestReporter) SkipTest ¶
func (r *TestReporter) SkipTest(testID, testName, reason string)
SkipTest marks a test as skipped
func (*TestReporter) StartTest ¶
func (r *TestReporter) StartTest(testID, testName string)
StartTest begins tracking a new test
type TestResult ¶
type TestResult struct {
TestID string
TestName string
Status string // PASS, FAIL, SKIP
Duration time.Duration
LogFile string
Error string
Stdout string
Stderr string
Command []string
ExitCode int
Timestamp time.Time
}
TestResult represents the result of a single test
type TestState ¶
type TestState struct {
// CLI execution state
CLIBinaryPath string
LastCommand []string
LastStdout string
LastStderr string
LastExitCode int
// Test context
TestID string
TestName string
TempDir string
ConfigDir string
WorkingDir string
// Gateway state
GatewayName string
GatewayServer string
// API state
APIName string
APIVersion string
// MCP state
MCPName string
MCPVersion string
// Coverage directory for CLI coverage collection
CLICoverDir string
// Timing
StartTime time.Time
EndTime time.Time
// contains filtered or unexported fields
}
TestState holds the state for a test scenario
func (*TestState) ExecuteCLI ¶
ExecuteCLI executes a CLI command and captures the output
func (*TestState) GetCombinedOutput ¶
GetCombinedOutput returns stdout and stderr combined
func (*TestState) GetConfigDir ¶
GetConfigDir returns the path to the isolated test config directory
func (*TestState) GetDuration ¶
GetDuration returns the test duration
func (*TestState) GetExitCode ¶
GetExitCode returns the last command's exit code
func (*TestState) SetAPIInfo ¶
SetAPIInfo sets the API information
func (*TestState) SetCLIBinaryPath ¶
SetCLIBinaryPath sets the path to the CLI binary
func (*TestState) SetCLICoverDir ¶
SetCLICoverDir sets the directory for CLI coverage data
func (*TestState) SetGatewayInfo ¶
SetGatewayInfo sets the gateway information
func (*TestState) SetMCPInfo ¶
SetMCPInfo sets the MCP information
func (*TestState) SetTestInfo ¶
SetTestInfo sets the current test information
type TestsConfig ¶
type TestsConfig struct {
Gateway GatewayTestsConfig `yaml:"gateway"`
}
TestsConfig holds all test group configurations
Directories
¶
| Path | Synopsis |
|---|---|
|
Package resources provides shared test values and constants for CLI integration tests.
|
Package resources provides shared test values and constants for CLI integration tests. |
|
Package steps provides step definitions for CLI integration tests.
|
Package steps provides step definitions for CLI integration tests. |