Testing Guide
February 13, 2023 ยท View on GitHub
This Helm Chart requires extensive testing to ensure expected behavior are met for everyone.
Requirements
All tests are run using Docker; no further dependencies are required.
Test Driven Development
"TDD" practise (Test Driven Development) should be followed when adding a new feature or fixing a bug.
It means that you are expected to:
- Start by adding a test describing the expected behaviour, that should fails (either because the bug exists in initial state, or because the new feature had not been implemented),
- Then, change the code according to your intent (fixing a bug, adding a feature or refactoring),
- Finally, the test suite (including the new test you added earlier) must pass.
Test Kinds
Please note that this chart has the following kind of tests (see respective sections below for description):
Unit Testing
Unit test suite is run by invoking the make target test: make test.
It is run by default on the CI.
Static Testing
The static test suite has the following properties:
- Static tests are about linting the YAML files, shell scripts and Helm elements. It is also a set of verifications around versions, names, etc.
- Static tests are fast to run, hence it must be run for each commit and pull requests and are considered blocking when failing.
- Static test suite is run by invoking the make target
lint:make lint. It is run by default on the CI.
The static test suite is implemented with the tool ct (Chart Testing):
- The Docker image of
ctis used to ensure all sub-dependencies (helm, kubectl, yamale, etc.) are met for an easier experience for contributor. - All configuration of
ctand linters are stored in the directorylint/. In particular, the filelint/ct.yamlcontains thectconfiguration. - Version Increment Check is done against the against the original repository, with the branch
master. This repository is added as an additional git remote namedtraefikby the make targetlint. If you wish to temporarly change this behavior, please edit the filesMakefileandlint/ct.yaml.