Platform APIs are usually tough to test. They hide complexity from users and abstract a wide range of backend services, ranging from heavy infrastructure over to simple SaaS APIs. Sometimes these processes can take up to hours to finish.
In this talk we will share our experience testing the platform API and introduce you to the tools we have written along the way.
The actual platform API is provided through crossplane. Writing crossplane compositions is not always easy and testing them with all possible combinations and outcomes is even harder. It requires a lot of effort to make sure all components are deployed correctly and work as expected – especially if you have a lot of them. Since everything is written in YAML and crossplane is a relatively new technology, there is no standard set of tools to test everything yet.
To test our compositions automatically, we have set up a CI pipeline that consists of two test stages: A static code analysis using our self-written linter for Crossplane that runs various checks, like ensuring that all patches are pointing to an existing resource property. The second stage consists of end-to-end tests built with Kuttl and compares the status of real provisioned infrastructure with the expected outcome.