This Helm Chart requires extensive testing to ensure expected behavior are met for everyone.
"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.
Please note that this chart has the following kind of tests (see respective sections below for description):
Before you can run the unit tests you need to set some ENV
. This is required to download the binary for the given platform. You don't need it on subsequent runs.
export CATTLE_HELM_UNITTEST_VERSION=v0.1.6-rancher1
export ARCH=amd64
make unit-test
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 inovking 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
ct
is used to ensure all sub-dependencies (helm, kubectl, yamale, etc.) are met for an easier experience for contributor. - All configuration of
ct
and linters are stored in the directorylint/
. In particular, the filelint/ct.yaml
contains thect
configuration. - Version Increment Check is done against the against the original repository, with the branch
master
. This repository is added as an additional git remote namedtraefik
by the make targetlint
. If you wish to temporarly change this behavior, please edit the filesMakefile
andlint/ct.yaml
.