Documentation
¶
Index ¶
- func AppendHostsFile(content string) error
- func ApplyConfig(config *Config) error
- func PrintTestResult(test *Test, result *TestResult)
- func PrintTestSummary(passed, failed, skipped int)
- func ProcessDynamicHeaders(dynamicHeaders []DynamicHeader, allHeaders map[string]string) error
- func RunTests(tests []*Test, config *Config) bool
- func SendHTTPRequest(config *HTTPRequestConfig) (*http.Response, []byte, error)
- type Config
- type DynamicHeader
- type HTTPRequestConfig
- type Test
- type TestFile
- type TestResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendHostsFile ¶
AppendHostsFile appends a string to /etc/hosts as a new line
func PrintTestResult ¶
func PrintTestResult(test *Test, result *TestResult)
PrintTestResult prints result of a single test
func PrintTestSummary ¶
func PrintTestSummary(passed, failed, skipped int)
PrintTestSummary prints summary info for multiple tests
func ProcessDynamicHeaders ¶
func ProcessDynamicHeaders(dynamicHeaders []DynamicHeader, allHeaders map[string]string) error
ProcessDynamicHeaders creates headers based on the function and adds them to the map of all headers.
func SendHTTPRequest ¶
func SendHTTPRequest(config *HTTPRequestConfig) (*http.Response, []byte, error)
SendHTTPRequest sends an HTTP request and returns response body and status
Types ¶
type Config ¶
type Config struct { Concurrency int DNSOverride string Host string PrintFailedTestsOnly bool TestDirectory string Verbosity int EnableRetries bool RetryCount int }
Config stores application configuration
type DynamicHeader ¶
type HTTPRequestConfig ¶
type HTTPRequestConfig struct { Method string URL string QueryParams map[string]string Headers map[string]string BasicAuthUsername string BasicAuthPassword string Body io.Reader TimeoutSeconds time.Duration SkipCertVerification bool MaxRetries int RetryCallback func(ctx context.Context, resp *http.Response, err error) (bool, error) }
HTTPRequestConfig type
type Test ¶
type Test struct { Filename string Description string Conditions struct { Env map[string]string `yaml:"env"` } `yaml:"conditions"` SkipCertVerification bool `yaml:"skipCertVerification"` Request struct { Scheme string `yaml:"scheme"` Host string `yaml:"host"` Method string `yaml:"method"` Path string `yaml:"path"` Headers map[string]string `yaml:"headers"` DynamicHeaders []DynamicHeader `yaml:"dynamicHeaders"` Body string `yaml:"body"` } `yaml:"request"` Response struct { StatusCodes []int `yaml:"statusCodes"` Headers struct { Patterns map[string]string `yaml:"patterns"` NotPresent []string `yaml:"notPresent"` NotMatching map[string]string `yaml:"notMatching"` IfPresentNotMatching map[string]string `yaml:"ifPresentNotMatching"` } `yaml:"headers"` Body struct { Patterns []string `yaml:"patterns"` } } `yaml:"response"` }
Test is a single test
func ParseAllTestsInDirectory ¶
ParseAllTestsInDirectory recursively parses all test definition files in a given directory
Click to show internal directories.
Click to hide internal directories.