Testing

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.

Before submitting a PR

Always run tests before submitting a PR to reduce the number of needless CI errors.

Docs only
  1. make test-static
Code
  1. make test-all

Local Test Environment

If running tests locally, access to a Kubernetes cluster of a compatible version 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

A local kind cluster is used for running tests.

Running Tests

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

Last modified February 24, 2021: docs: document k8s version compatibility and platform support (#4574) (a5338a31)