Skip to content

Latest commit

 

History

History
43 lines (28 loc) · 1.46 KB

README.md

File metadata and controls

43 lines (28 loc) · 1.46 KB

Testing CRDs

This repo accompanies the talk Testing Kubernetes CRDs at Kubecon Shanghai 2018.

Tests

Test pyramid, unit at the bottom, then integration and end to end at the top

Integration tests with kubebuilder

These tests are generated by kubebuilder and use Ginkgo. They will start a controller process and api server locally.

The test (which hasn't been modified from the default) lives in feline_controller_test.go.

To run these tests:

go test ./pkg/controller/feline

End to end tests

After you have deployed the controller, you can run the integration tests against the current-context cluster in your kube config:

go test -v -count=1 -tags=e2e ./client-go/test
go test -v -count=1 -tags=e2e ./kubebuilder/test

-count=1 is the idiomatic way to disable test caching.

You can override the kubeconfig and context if you'd like:

go test -v -tags=e2e -count=1 ./client-go/test --kubeconfig ~/special/kubeconfig --cluster myspecialcluster