Documentation
¶
Index ¶
- func DefaultObjectCheckForOperation(op driver.ObjectOperationType) *ast.Module
- func Run(testDoc *doc.Document, opts ...RunOpt) error
- type Closer
- type CloserFunc
- type Document
- type Recorder
- type RunOpt
- func CheckTimeoutOpt(timeout time.Duration) RunOpt
- func DryRunOpt() RunOpt
- func KubeClientOpt(kube *driver.KubeClient) RunOpt
- func PreserveObjectsOpt() RunOpt
- func RecorderOpt(r Recorder) RunOpt
- func RegoModuleOpt(m *ast.Module) RunOpt
- func RegoParamOpt(key string, val string) RunOpt
- func TraceRegoOpt() RunOpt
- func WatchResourceOpt(gvr schema.GroupVersionResource) RunOpt
- type Step
- type SummaryWriter
- type TapWriter
- type TreeWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultObjectCheckForOperation ¶
func DefaultObjectCheckForOperation(op driver.ObjectOperationType) *ast.Module
DefaultObjectCheckForOperation returns a built-in default check for applying Kubernetes objects.
Types ¶
type Closer ¶
type Closer interface {
Close()
}
Closer is an interface that closes an implicit test tracking entity.
type CloserFunc ¶
type CloserFunc func()
CloserFunc is a Closer adaptor. This adaptor can be used with nil function pointers.
type Recorder ¶
type Recorder interface { // ShouldContinue returns whether a test harness should // continue to run tests. Typically, this will return false // if a fatal test error has been reported. ShouldContinue() bool // Failed returns true if any errors have been reported. Failed() bool // NewDocument created a new test document that can be // closed by calling the returned Closer. NewDocument(desc string) Closer // NewDocument created a new test document that can be // closed by calling the returned Closer. NewStep(desc string) Closer Update(...result.Result) }
Recorder is an object that records structured test information.
var DefaultRecorder Recorder = &defaultRecorder{}
DefaultRecorder ...
func StackRecorders ¶
StackRecorders returns a new Recorder that stacks top and next. For each method in the Recorder interface, methods from top will be called first, followed by the ones from next.
type RunOpt ¶
type RunOpt func(*testContext)
RunOpt sets options for the test run.
func CheckTimeoutOpt ¶
CheckTimeoutOpt sets the check timeout.
func KubeClientOpt ¶
func KubeClientOpt(kube *driver.KubeClient) RunOpt
KubeClientOpt sets the Kubernetes client.
func PreserveObjectsOpt ¶
func PreserveObjectsOpt() RunOpt
PreserveObjectsOpt disables automatic object deletion.
func RegoModuleOpt ¶
RegoModuleOpt makes the given module available to the Rego evaluation.
func RegoParamOpt ¶
RegoParamOpt writes a parameter into the Rego store, rooted at the path `/test/params`. If the parameter name contains interior dots (e.g. "foo.bar.baz"), those are converted into path separators.
func WatchResourceOpt ¶
func WatchResourceOpt(gvr schema.GroupVersionResource) RunOpt
WatchResourceOpt disables automatic object deletion.
type Step ¶
type Step struct { Description string Start time.Time End time.Time Results []result.Result Diagnostics map[string]interface{} }
Step describes a stage in a test document that can generate onr or more related errors.
type SummaryWriter ¶
type SummaryWriter struct {
// contains filtered or unexported fields
}
SummaryWriter collects a summary of the final test results.
func (*SummaryWriter) NewDocument ¶
func (s *SummaryWriter) NewDocument(desc string) Closer
NewDocument ...
func (*SummaryWriter) ShouldContinue ¶
func (s *SummaryWriter) ShouldContinue() bool
ShouldContinue ...
func (*SummaryWriter) Summarize ¶
func (s *SummaryWriter) Summarize(out io.Writer)
Summarize write a summary of the test results to out.
type TapWriter ¶
type TapWriter struct {
// contains filtered or unexported fields
}
TapWriter writes test records in TAP format. See https://testanything.org/tap-version-13-specification.html
type TreeWriter ¶
type TreeWriter struct {
// contains filtered or unexported fields
}
TreeWriter is a Recorder that write test results to a standard output in a tree notation.
func (*TreeWriter) NewDocument ¶
func (t *TreeWriter) NewDocument(desc string) Closer
NewDocument ...