Documentation ¶
Index ¶
- func And(cel ...string) string
- func ArchitectureEquals(arch string) string
- func FactEquals(key, value string) string
- func InstallerEquals(installer string) string
- func NetworkEquals(network string) string
- func NetworkStackEquals(networkStack string) string
- func Or(cel ...string) string
- func PlatformEquals(platform string) string
- func TopologyEquals(topology string) string
- func UpgradeEquals(upgrade string) string
- func VersionEquals(version string) string
- type Details
- type EnvironmentSelector
- type ExtensionTestResult
- type ExtensionTestResults
- type ExtensionTestSpec
- type ExtensionTestSpecs
- func (specs ExtensionTestSpecs) AddAfterAll(fn func())
- func (specs ExtensionTestSpecs) AddAfterEach(fn func(task *ExtensionTestResult))
- func (specs ExtensionTestSpecs) AddBeforeAll(fn func())
- func (specs ExtensionTestSpecs) AddBeforeEach(fn func(spec ExtensionTestSpec))
- func (specs ExtensionTestSpecs) AddLabel(labels ...string) ExtensionTestSpecs
- func (specs ExtensionTestSpecs) Exclude(excludeCEL string) ExtensionTestSpecs
- func (specs ExtensionTestSpecs) Filter(celExprs []string) (ExtensionTestSpecs, error)
- func (specs ExtensionTestSpecs) FilterByEnvironment(envFlags flags.EnvironmentalFlags) (ExtensionTestSpecs, error)
- func (specs ExtensionTestSpecs) Include(includeCEL string) ExtensionTestSpecs
- func (specs ExtensionTestSpecs) MustFilter(celExprs []string) ExtensionTestSpecs
- func (specs ExtensionTestSpecs) Names() []string
- func (specs ExtensionTestSpecs) RemoveLabel(labels ...string) ExtensionTestSpecs
- func (specs ExtensionTestSpecs) Run(w ResultWriter, maxConcurrent int) error
- func (specs ExtensionTestSpecs) Select(selectFn SelectFunction) ExtensionTestSpecs
- func (specs ExtensionTestSpecs) SelectAll(selectFns []SelectFunction) ExtensionTestSpecs
- func (specs ExtensionTestSpecs) SelectAny(selectFns []SelectFunction) ExtensionTestSpecs
- func (specs ExtensionTestSpecs) SetTag(key, value string) ExtensionTestSpecs
- func (specs ExtensionTestSpecs) UnsetTag(key string) ExtensionTestSpecs
- func (specs ExtensionTestSpecs) Walk(walkFn func(*ExtensionTestSpec)) ExtensionTestSpecs
- type Isolation
- type JSONResultWriter
- type Lifecycle
- type NullResultWriter
- type OneTimeTask
- type Resources
- type Result
- type ResultFormat
- type ResultWriter
- type SelectFunction
- type SpecTask
- type TestResultTask
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArchitectureEquals ¶
func FactEquals ¶
func InstallerEquals ¶
func NetworkEquals ¶
func NetworkStackEquals ¶
func PlatformEquals ¶
func TopologyEquals ¶
func UpgradeEquals ¶
func VersionEquals ¶
Types ¶
type Details ¶
type Details struct { Name string `json:"name"` Value interface{} `json:"value"` }
Details are human-readable messages to further explain skips, timeouts, etc. It can also be used to provide contemporaneous information about failures that may not be easily returned by must-gather. For larger artifacts (greater than 10KB, write them to $EXTENSION_ARTIFACTS_DIR.
type EnvironmentSelector ¶
type EnvironmentSelector struct { Include string `json:"include,omitempty"` Exclude string `json:"exclude,omitempty"` }
func (EnvironmentSelector) IsEmpty ¶
func (e EnvironmentSelector) IsEmpty() bool
type ExtensionTestResult ¶
type ExtensionTestResult struct { Name string `json:"name"` Lifecycle Lifecycle `json:"lifecycle"` Duration int64 `json:"duration"` StartTime *dbtime.DBTime `json:"startTime"` EndTime *dbtime.DBTime `json:"endTime"` Result Result `json:"result"` Output string `json:"output"` Error string `json:"error,omitempty"` Details []Details `json:"details,omitempty"` }
func (*ExtensionTestResult) AddDetails ¶
func (result *ExtensionTestResult) AddDetails(name string, value interface{})
AddDetails adds additional information to an ExtensionTestResult. Value must marshal to JSON.
type ExtensionTestResults ¶
type ExtensionTestResults []*ExtensionTestResult
func (ExtensionTestResults) Walk ¶
func (results ExtensionTestResults) Walk(walkFn func(*ExtensionTestResult))
type ExtensionTestSpec ¶
type ExtensionTestSpec struct { Name string `json:"name"` // OriginalName contains the very first name this test was ever known as, used to preserve // history across all names. OriginalName string `json:"originalName,omitempty"` // Labels are single string values to apply to the test spec Labels sets.Set[string] `json:"labels"` // Tags are key:value pairs Tags map[string]string `json:"tags,omitempty"` // Resources gives optional information about what's required to run this test. Resources Resources `json:"resources"` // Source is the origin of the test. Source string `json:"source"` // Lifecycle informs the executor whether the test is informing only, and should not cause the // overall job run to fail, or if it's blocking where a failure of the test is fatal. // Informing lifecycle tests can be used temporarily to gather information about a test's stability. // Tests must not remain informing forever. Lifecycle Lifecycle `json:"lifecycle"` // EnvironmentSelector allows for CEL expressions to be used to control test inclusion EnvironmentSelector EnvironmentSelector `json:"environmentSelector,omitempty"` // Run invokes a test Run func() *ExtensionTestResult `json:"-"` // contains filtered or unexported fields }
func (*ExtensionTestSpec) Exclude ¶
func (spec *ExtensionTestSpec) Exclude(excludeCEL string) *ExtensionTestSpec
Exclude adds the specified CEL expression to explicitly exclude tests by environment
func (*ExtensionTestSpec) Include ¶
func (spec *ExtensionTestSpec) Include(includeCEL string) *ExtensionTestSpec
Include adds the specified CEL expression to explicitly include tests by environment
type ExtensionTestSpecs ¶
type ExtensionTestSpecs []*ExtensionTestSpec
func (ExtensionTestSpecs) AddAfterAll ¶
func (specs ExtensionTestSpecs) AddAfterAll(fn func())
AddAfterAll adds a function to be run once after all tests have finished.
func (ExtensionTestSpecs) AddAfterEach ¶
func (specs ExtensionTestSpecs) AddAfterEach(fn func(task *ExtensionTestResult))
AddAfterEach adds a function that runs after each test has finished executing. The ExtensionTestResult can be modified if needed. The provided function must be thread safe.
func (ExtensionTestSpecs) AddBeforeAll ¶
func (specs ExtensionTestSpecs) AddBeforeAll(fn func())
AddBeforeAll adds a function to be run once before all tests start executing.
func (ExtensionTestSpecs) AddBeforeEach ¶
func (specs ExtensionTestSpecs) AddBeforeEach(fn func(spec ExtensionTestSpec))
AddBeforeEach adds a function that runs before each test starts executing. The ExtensionTestSpec is passed in for contextual information, but must not be modified. The provided function must be thread safe.
func (ExtensionTestSpecs) AddLabel ¶
func (specs ExtensionTestSpecs) AddLabel(labels ...string) ExtensionTestSpecs
AddLabel adds the labels to each spec.
func (ExtensionTestSpecs) Exclude ¶
func (specs ExtensionTestSpecs) Exclude(excludeCEL string) ExtensionTestSpecs
Exclude adds the specified CEL expression to explicitly exclude tests by environment to each spec
func (ExtensionTestSpecs) Filter ¶
func (specs ExtensionTestSpecs) Filter(celExprs []string) (ExtensionTestSpecs, error)
Filter filters specs using the given celExprs. Each celExpr is OR'd together, if any match the spec is included in the filtered set.
func (ExtensionTestSpecs) FilterByEnvironment ¶
func (specs ExtensionTestSpecs) FilterByEnvironment(envFlags flags.EnvironmentalFlags) (ExtensionTestSpecs, error)
FilterByEnvironment checks both the Include and Exclude fields of the ExtensionTestSpec to return those specs which match. Tests will be included by default unless they are explicitly excluded. If Include is specified, only those tests matching the CEL expression will be included.
See helper functions in extensiontests/environment.go to craft CEL expressions
func (ExtensionTestSpecs) Include ¶
func (specs ExtensionTestSpecs) Include(includeCEL string) ExtensionTestSpecs
Include adds the specified CEL expression to explicitly include tests by environment to each spec
func (ExtensionTestSpecs) MustFilter ¶
func (specs ExtensionTestSpecs) MustFilter(celExprs []string) ExtensionTestSpecs
MustFilter filters specs using the given celExprs. Each celExpr is OR'd together, if any match the spec is included in the filtered set. If your CEL expression is invalid or filtering otherwise fails, this function panics.
func (ExtensionTestSpecs) Names ¶
func (specs ExtensionTestSpecs) Names() []string
func (ExtensionTestSpecs) RemoveLabel ¶
func (specs ExtensionTestSpecs) RemoveLabel(labels ...string) ExtensionTestSpecs
RemoveLabel removes the labels from each spec.
func (ExtensionTestSpecs) Run ¶
func (specs ExtensionTestSpecs) Run(w ResultWriter, maxConcurrent int) error
Run executes all the specs in parallel, up to maxConcurrent at the same time. Results are written to the given ResultWriter after each spec has completed execution. BeforeEach, BeforeAll, AfterEach, AfterAll hooks are executed when specified. "Each" hooks must be thread safe. Returns an error if any test spec failed, indicating the quantity of failures.
func (ExtensionTestSpecs) Select ¶
func (specs ExtensionTestSpecs) Select(selectFn SelectFunction) ExtensionTestSpecs
Select filters the ExtensionTestSpecs to only those that match the provided SelectFunction
func (ExtensionTestSpecs) SelectAll ¶
func (specs ExtensionTestSpecs) SelectAll(selectFns []SelectFunction) ExtensionTestSpecs
SelectAll filters the ExtensionTestSpecs to only those that match all the provided SelectFunctions
func (ExtensionTestSpecs) SelectAny ¶
func (specs ExtensionTestSpecs) SelectAny(selectFns []SelectFunction) ExtensionTestSpecs
SelectAny filters the ExtensionTestSpecs to only those that match any of the provided SelectFunctions
func (ExtensionTestSpecs) SetTag ¶
func (specs ExtensionTestSpecs) SetTag(key, value string) ExtensionTestSpecs
SetTag specifies a key/value pair for each spec.
func (ExtensionTestSpecs) UnsetTag ¶
func (specs ExtensionTestSpecs) UnsetTag(key string) ExtensionTestSpecs
UnsetTag removes the specified key from each spec.
func (ExtensionTestSpecs) Walk ¶
func (specs ExtensionTestSpecs) Walk(walkFn func(*ExtensionTestSpec)) ExtensionTestSpecs
Walk iterates over all test specs, and executions the function provided. The test spec can be mutated.
type JSONResultWriter ¶
type JSONResultWriter struct {
// contains filtered or unexported fields
}
func NewResultWriter ¶
func NewResultWriter(out io.Writer, format ResultFormat) (*JSONResultWriter, error)
func (*JSONResultWriter) Flush ¶
func (w *JSONResultWriter) Flush()
func (*JSONResultWriter) Write ¶
func (w *JSONResultWriter) Write(result *ExtensionTestResult)
type Lifecycle ¶
type Lifecycle string
var LifecycleBlocking Lifecycle = "blocking"
var LifecycleInforming Lifecycle = "informing"
type NullResultWriter ¶
type NullResultWriter struct{}
func (NullResultWriter) Flush ¶
func (NullResultWriter) Flush()
func (NullResultWriter) Write ¶
func (NullResultWriter) Write(*ExtensionTestResult)
type OneTimeTask ¶
type OneTimeTask struct {
// contains filtered or unexported fields
}
func (*OneTimeTask) Run ¶
func (t *OneTimeTask) Run()
type Result ¶
type Result string
var ResultFailed Result = "failed"
var ResultPassed Result = "passed"
var ResultSkipped Result = "skipped"
type ResultFormat ¶
type ResultFormat string
var ( JSON ResultFormat = "json" JSONL ResultFormat = "jsonl" )
type ResultWriter ¶
type ResultWriter interface { Write(result *ExtensionTestResult) Flush() }
type SelectFunction ¶
type SelectFunction func(spec *ExtensionTestSpec) bool
func HasLabel ¶
func HasLabel(label string) SelectFunction
HasLabel returns a function that selects specs with the provided label
func HasTagWithValue ¶
func HasTagWithValue(key, value string) SelectFunction
HasTagWithValue returns a function that selects specs containing a tag with the provided key and value
func NameContains ¶
func NameContains(name string) SelectFunction
NameContains returns a function that selects specs whose name contains the provided string
func WithLifecycle ¶
func WithLifecycle(lifecycle Lifecycle) SelectFunction
WithLifecycle returns a function that selects specs with the provided Lifecycle
type SpecTask ¶
type SpecTask struct {
// contains filtered or unexported fields
}
func (*SpecTask) Run ¶
func (t *SpecTask) Run(spec ExtensionTestSpec)
type TestResultTask ¶
type TestResultTask struct {
// contains filtered or unexported fields
}
func (*TestResultTask) Run ¶
func (t *TestResultTask) Run(result *ExtensionTestResult)