

Check the doc.īefore start developing this plugin, you must have ( ) >= 1.14 installed, and run: git clone helm-unittestĪnd please make CI passed when request a PR which would check following things: Note this does create resources on your cluster to verify if your release is correct. Helm test: test a release with testing pod defined in chart. Helm lint: examines a chart for possible issues, useful to validate chart dependencies. Helm template: render the chart and print the output. This plugin is inspired by helm-template, and the idea of snapshot testing and some printing format comes from jest.Īnd there are some other helm commands you might want to use: # no need to prefix with "child-chart." somevalue: should_be_scopedĬheck _fixtures_/v2/with-subchart/ or _fixtures_/v3/with-subchart/ as an example. Notice that the values defined in subchart tests will be automatically scoped, you don't have to add dependency scope yourself: # with-subchart/charts/child-chart/tests/xxx_test.yaml templates: You can disable this behavior by setting -with-subchart=false flag in cli, thus only the tests in root chart will be executed. If you have customized subchart (not installed via helm dependency) existed in charts directory, tests inside would also be executed by default. Note 2: using the folder structure in templates can also be used to unittest templates which are placed in subfolders or unittest subcharts from the rootchart.Ĭheck _fixtures_/v2/with-subchart/ or _fixtures_/v3/with-subchart/ as an example. Note 1: if dependend subcharts uses an alias, use the alias name in the templates. # this time required to prefix with "postgresql." # $YOUR_CHART/tests/xxx_test.yaml templates: This feature can be helpfull to validate if good default values are accidently overwritten within your default helm chart. If you have dependend subcharts (installed via helm dependency) existed in charts directory (they don't need to be extracted), it is possible to unittest these from the root chart. Dependend subchart Testing (Requirements.yaml) The cache files is stored as _snapshot_/v2/*_ at the directory your test file placed, you should add them in version control with your chart.
#Airflow helm chart update
It fails if the content changed, and you should check and update the cache with -u, -update-snapshot option of cli. The matchSnapshot assertion validate the content rendered the same as cached last time. # or you can snapshot the whole manifest - it: manifest should match snapshot That's the reason for snapshot testing! Check the tests below: templates: Sometimes you may just want to keep the rendered manifest not changed between changes without every details asserted. s, -with-subchart charts include tests of the subcharts within charts folder (default true)Ĭheck _fixtures_/v2/basic/ for some basic use cases of a simple chart (version 3).

u, -update-snapshot update the snapshot cached if needed, make sure you review the change before update o, -output-file string output-type the file-format where testresults are written in, accepted types are (JUnit, NUnit, XUnit) (default XUnit) 3, -helm3 parse helm charts as helm3 charts (default false) f, -file stringArray glob paths of test files location, default to tests\*_test.yaml (default ) Flags -color enforce printing colored output even stdout is not a tty. This renders your charts locally (without tiller) and runs tests defined in test suite files. You can also have your own suite files arrangement with -f, -file option of cli set as the glob patterns of test suite files related to chart directory, like: $ helm unittest - f 'my-tests/*.yaml' - f 'more-tests/*.yaml' my - chartĬheck DOCUMENT for more details about writing tests. The test suite file is written in pure YAML, and default placed under the tests/ directory of the chart with suffix _test.yaml. Now there is your first test! ) Test Suite File helmignore of your chart, and create the following test file at $YOUR_CHART/tests/deployment_test.yaml: suite: test deployment
#Airflow helm chart install
It will install the latest version of binary into helm plugin directory. If you are ready for writing tests, check the DOCUMENT for the test API in YAML. Unit test for helm chart in YAML to keep your chart consistent and robust!
