Write end-to-end tests for Kubernetes leveraging lightly templated yaml files.
Rigging depends on ko to run and be configured in the context of the go test run.
After you have ko
working and a target Kubernetes cluster with kubectl
,
testing should be as simple as running:
go test ./example/... -tags e2e -v
Or to just run TestFoo
:
go test ./example/... -run Foo -tags e2e -v -=count=1
Note: Rigging assumes the cluster is ready for testing. You can use rigging to setup dependent resources, but this should be limited to resources that are namespaced.
Rigging will create a namespace to be used for the test. All dependent namespace scoped resources that the test depends on should be included in the rig. The namespace used in Rigging will be deleted after the test has finished. This allows Rigging to run many tests in parallel assuming the test author understands any global cluster concerns.
-
Tests register their interest in an image by
RegisterPackage
in their init method. -
Test calls
rigging.NewInstall
and receives arig
instance to be used for further testing and cleanup.Internally, rigging will:
- Apply all given options to the test rig.
- Create a new generated namespace.
- Produce images (using
ko
). - Apply config to the given set of yaml config files.
- Apply template processed config files to the kubernetes cluster.
-
Test performs the test implementation.
-
Test collects results and determine PASS/FAIL.
-
Test calls
rig.Uninstall()
to delete all resources and the test namespace.Internally, rigging will:
- Delete all resources created by the rig.
- Delete the generated namespace, if created by the rig.