Run tests and tasks
Tests
Container
The container
Run and Test actions can be used for running one off jobs as a Pod using a given container image and similarly for running test. For example:
Helm Pod
This action type can be used for Run and Test actions where you already have the corresponding Helm charts. It's similar to the kubernetes-pod
action type.
See the helm-pod
Run and helm-pod
Test reference docs for more details.
Kubernetes Pod
For Run and Test actions, either the kubernetes-pod
or kubernetes-exec
actions can be used.
kubernetes-pod
Run and kubernetes-pod
test will create a fresh Kubernetes workload and run your command in it. These actions are cached. This means that Garden will not rerun them if the version of the action hasn't changed. If a remote Kubernetes cluster is used, test results are stored there which allows to share test results between the team or CI runs to decrease the number or re-runs.
kubernetes-pod
actions don't have to depend on the deploy actions. The manifests are gathered from the kubernetes manifests and deployed to the cluster.
Kubernetes Exec
kubernetes-exec
Run andkubernetes-exec
Test actions are used to execute a command in an already deployed
Kubernetes Pod and wait for it to complete. These actions are not cached. They can be used with deploys running in sync mode
for rapid testing and development. These actions should depend on the deploy action that creates the kubernetes workloads they run in.
Here's a run action from the vote-helm example that initializes the database by running a command in the already deployed kubernetes workload.
Test Artifacts
Many action types, including container
, exec
and helm
, allow you to extract artifacts after Tests have completed. This can be handy when you'd like to view reports or logs, or if you'd like a script (via a local exec
action, for instance) to validate the output from a Test.
Desired artifacts can be specified using the spec.artifacts
field on Test configurations. For example, for the container
Test, you can do something like this:
After running my-test
, you can find the contents of the report
directory in the test's container, locally under .garden/artifacts/my-test-report
.
Please look at individual action type references to see how to configure each Run to extract artifacts.
Tasks
Container
The container
Run and Test actions can be used for running one off jobs as a Pod using a given container image and similarly for running test. For example:
Helm Pod
This action can be used for Run and Test actions where you already have the corresponding Helm charts. It's similar to the kubernetes-pod
action.
See the helm-pod
Run and helm-pod
Test reference docs for more details.
Kubernetes Pod
For Run and Test actions, either the kubernetes-pod
or kubernetes-exec
actions can be used.
kubernetes-pod
Run and kubernetes-pod
test will create a fresh Kubernetes workload and run your command in it. These actions are cached. This means that Garden will not rerun them if the version of the action hasn't changed. If a remote Kubernetes cluster is used, test results are stored there which allows to share test results between the team or CI runs to decrease the number or re-runs.
kubernetes-pod
actions don't have to depend on the deploy actions. The manifests are gathered from the kubernetes manifests and deployed to the cluster.
Kubernetes Exec
kubernetes-exec
Run and kubernetes-exec
Test actions are used to execute a command in an already deployed Kubernetes Pod and wait for it to complete. These actions are not cached. They can be used with deploys running in sync mode for rapid testing and development. These actions should depend on the deploy action that creates the kubernetes workloads they run in.
Here's a run action from the vote-helm example that initializes the database by running a command in the already deployed kubernetes workload.
Last updated
Was this helpful?