Documentation
¶
Index ¶
Constants ¶
const ( ExitCode = "ExitCode" Stdout = "Stdout" Stderr = "Stderr" LineCount = "LineCount" )
Constants for defining the various tested properties
const WorkerCountMultiplicator = 5
Variables ¶
This section is empty.
Functions ¶
func Start ¶
func Start(tests []TestCase, maxConcurrent int) <-chan TestResult
Start starts the given test suite and executes all tests maxConcurrent configures the amount of go routines which will be started
Types ¶
type CommandResult ¶
type CommandResult struct {
Status ResultStatus
Stdout string
Stderr string
ExitCode int
FailureProperties []string
Error error
}
CommandResult holds the result for a specific test
type CommandUnderTest ¶
type CommandUnderTest struct {
Cmd string
InheritEnv bool
Env map[string]string
Dir string
Timeout string
Retries int
Interval string
}
CommandUnderTest represents the command under test
func (*CommandUnderTest) GetRetries ¶ added in v1.0.0
func (c *CommandUnderTest) GetRetries() int
GetRetries returns the retries of the command
type Expected ¶
type Expected struct {
Stdout ExpectedOut
Stderr ExpectedOut
LineCount int
ExitCode int
}
Expected is the expected output of the command under test
type ExpectedOut ¶
type ExpectedOut struct {
Contains []string `yaml:"contains,omitempty"`
Lines map[int]string `yaml:"lines,omitempty"`
Exactly string `yaml:"exactly,omitempty"`
LineCount int `yaml:"line-count,omitempty"`
NotContains []string `yaml:"not-contains,omitempty"`
JSON map[string]string `yaml:"json,omitempty"`
XML map[string]string `yaml:"xml,omitempty"`
}
ExpectedOut represents the assertions on stdout and stderr
type ResultStatus ¶
type ResultStatus int
ResultStatus represents the status code of a test result
const ( //Success status Success ResultStatus = iota // Failed status Failed // Skipped status Skipped )
Result status codes
type TestCase ¶
type TestCase struct {
Title string
Command CommandUnderTest
Expected Expected
Result CommandResult
}
TestCase represents a test case which will be executed by the runtime
type TestConfig ¶
type TestConfig struct {
Env map[string]string
Dir string
Timeout string
Retries int
Interval string
InheritEnv bool
}
TestConfig represents the configuration for a test
type TestResult ¶
type TestResult struct {
TestCase TestCase
ValidationResult ValidationResult
FailedProperty string
Tries int
}
TestResult represents the TestCase and the ValidationResult
func Validate ¶
func Validate(test TestCase) TestResult
Validate validates the test results with the expected values The test should hold the result and expected to validate the result
type ValidationResult ¶
ValidationResult will be returned after the validation was executed