On all PRs, a suite of static and cluster tests is run against your changes in a CI environment. These tests can also be run locally, which is discussed below.

Static tests consist of unit, formatting, and doc link tests.

Cluster tests consist of several test types:

  • End-to-end (e2e): simulate the “happy path” usage of the operator-sdk binary and resulting operator project.
  • Integration: test components of the operator-sdk binary and features of scaffolded projects that are bound to external projects, such as OLM.
  • Subcommand: ensure individual subcommands function as intended with a variety of input options.

Local Test Environment

If running tests locally, access to a Kubernetes cluster of server version v1.11.3 or higher is required. These tests require KUBECONFIG be set or kubeconfig file be present in a default location like $HOME/.kube/config.

You will also need to set up an envtest environment for cluster tests. Follow this doc for setup instructions.

Local clusters

Two options for testing with a local cluster are minikube and kind. Ensure KUBECONFIG is set correctly for the chosen cluster type.

Running Tests

On any PR, the entire test suite is run against your changes in a CI environment. Therefore it is advantageous to run all tests before pushing changes to the remote repo:

make test-sanity test-links test-unit test-subcommand test-integration test-e2e

All the tests are run through the Makefile. Run make help for a full list of available tests.