Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Latest commit

 

History

History
76 lines (57 loc) · 3.09 KB

integration-tester_run.md

File metadata and controls

76 lines (57 loc) · 3.09 KB

integration-tester run

Run a set of test documents

Synopsis

Execute a set of test documents given as arguments.

Test documents are ordered fragments of YAML object and Rego checks, separated by the YAML document separator, '---'. The fragments in the test document are executed sequentially.

If a Kubernetes object specifies a target namespace in its metadata, integration-tester will implicitly create and manage that namespace. This reduces test verbosity be not requiring namespace YAML fragments.

When integration-tester creates Kubernetes objects, it uses the current default Kubernetes client context. Each Kubernetes object it creates is labeled with the 'app.kubernetes.io/managed-by=integration-tester' label. Objects are also annotated with a unique test run ID under the key 'integration-tester/run-id'

integration-tester will delete the target Kubernetes object if the special '$apply' key has the value 'delete'. If the target object has a name, integration-tester will delete that object. Otherwise, integration-tester will attempt to select an object to delete by matching the run ID and any specified labels.

Unless the '--preserve' flag is specified, integration-tester will automatically delete all the Kubernetes objects it created at the end of each test.

Since both Kubernetes and the services in a cluster are eventually consistent, checks are executed repeatedly until they succeed or until the timeout given by the '--check-timeout' flag expires.

The '--param' flag can be provided multiple times to add an element to the Rego data store. The argument to this flag is a "key=value" pair. The value is stored as 'data.test.params.key'.

integration-tester will automatically watch resource types that are created in a test document and publish them into Rego checks in the 'data.resources' tree. If a test needs to inspect more resources, the '--watch' flag can be provided multiple times to specify additional resource types to monitor and publish.

The test results output format can be changed by the '--format' flag. The default format is 'tree', which is a custom hierarchical format suitable for terminals. The "tap" format emits TAP (Test Anything Protocol) results.

integration-tester run [FLAGS ...] FILE [FILE ...]

Options

      --check-timeout duration   Timeout for evaluating check steps (default 30s)
      --dry-run                  Don't actually create Kubernetes objects
      --fixtures strings         Additional Kubernetes resource fixtures
      --format string            Test results output format (default "tree")
  -h, --help                     help for run
      --param stringArray        Additional Rego parameter(s) in key=value format
      --policies strings         Additional Rego policy packages
      --preserve                 Don't automatically delete Kubernetes objects
      --trace string             Set execution tracing flags
      --watch strings            Additional Kubernetes resources to monitor

SEE ALSO

Auto generated by spf13/cobra on 2-Nov-2020