Skip to content

Add helm unittest and one basic example

Vladimir Shushlin requested to merge vshushlin/helm-unittest into main

While reviewing chore(gitlab-runner): add support to avoid moun... (!399 - closed), I noticed that we don't have any unittests for the runner helm chart at all.

That makes it really hard to do reviews because we need to verify each MR manually, and have no automated checks.

This MR adds unit tests with the following goals to improve maintainability: every time we make a change, we can add a simple unit test and have some minimal assurance that it won't be broken in the future without notice

I'm not focusing on heavier integration tests: we can't write integration tests for every small change, integration tests often break for unrelated reasons, and they take significant time to run.

The main gitlab chart uses Rspec as a test framework and we write tests like this: https://gitlab.com/gitlab-org/charts/gitlab/-/blob/master/spec/configuration/pages_spec.rb . I like that approach, but most of the people on the runner team are golang engineers, and rspec isn't trivial to learn.

Some googling lead to helm unittest plugin, and it looks alright:

  1. it runs extremely fast
  2. the syntax for tests is a simple yaml, and it's quite intuitive

I also wrote a very basic example(focused on code related to chore(gitlab-runner): add support to avoid moun... (!399 - closed)) and the CI pipeline.

Edited by Vladimir Shushlin

Merge request reports