StackStorm / stackstorm-k8s

K8s Helm Chart that codifies StackStorm (aka "IFTTT for Ops" https://stackstorm.com/) Highly Availability fleet as a simple to use reproducible infrastructure-as-code app
https://helm.stackstorm.com/
Apache License 2.0
105 stars 106 forks source link

Helm chart Unit Tests #28

Open arm4b opened 6 years ago

arm4b commented 6 years ago

Apart of Helm Chart Integration Testing in #27 which could be ran only against real K8s cluster and deployed release, consider adding Unit Tests for smaller item checks which is available as a Helm plugin: ~https://github.com/lrills/helm-unittest~ https://github.com/quintush/helm-unittest

cognifloyd commented 2 years ago

Though not a unittest, I just experimented with using https://github.com/bats-core/bats-detik to have the inegration tests query k8s to ensure things are setup correctly. Seems to work ok.

cognifloyd commented 2 years ago

I looked into the helm-unittest plugin. There are a chain of repos where one person and then another is maintaining it. And I don't relish writing unit tests in YAML even though everything else is in YAML.

Looking farther, it looks like the airflow folks pioneered using pytest to unit test helm charts instead of using helm-unittest: https://github.com/helm-unittest/helm-unittest/issues/110

Luckily airflow (and in particular the helm chart + tests) is Apache 2.0 licensed. So, we could use this utility file and start writing pytest-style unit tests. https://github.com/apache/airflow/blob/main/chart/tests/helm_template_generator.py

cognifloyd commented 2 years ago

I've added a bunch of tests in #288.

Other tests that I think would be good (I'm listing values) in no particular order:

Help wanted!