Testing your Operator project
The Operator SDK project recommends using controller-runtime’s envtest to write tests for your Operators projects. Envtest has a more active contributor community, it is more mature than Operator SDK’s test framework, and it does not require an actual cluster to run tests which can be a huge benefit in CI scenarios.
You will see that is created when a controller is scaffolded by the tool. This file contains boilerplate for executing integration tests using with ginkgo and .
The projects generated by using the SDK tool have a Makefile which contains the target tests which executes when you run . Note that this target will also execute when you run .
Operator SDK adopted this stack to write tests for its operators. It might be useful to check writing controller tests documentation and examples to learn how to better write tests for your operator. See, for example, that is covered by tests using the same stack as well.
To implement application-specific tests, the SDK’s test harness, scorecard, provides the ability to ship custom code in container images as well, which can be referenced in the test suite. Because this test suite definition metadata travels with the Operator Bundle, it allows for functional testing of the Operator without the source code or the project layout being available. See .