surrealdb / helm-charts

4 stars 5 forks source link

Add unit tests for the chart templates #11

Closed mumoshu closed 1 month ago

mumoshu commented 1 month ago

Let me add unit tests written in plain Go to catch templating issues like the one found at https://github.com/surrealdb/helm-charts/pull/9#pullrequestreview-2368588011.

This follows the best practice based on my experience maintaining Helm charts and testing as much as possible before deploying the chart to local and remote clusters. Snapshot testing is handy because it runs quite fast and is perfect for detecting any unexpected changes.

Once this is merged, maintainers and contributors are encouraged to add a few lines to tests/surrealdb_test.go when they add control structures like if and range to the templates so that branching is tested and future regressions can be prevented.

I opted not to use:

Those tools are great. I'm just proposing to use the one that is sufficient and enough for this specific project today, and that's plain Go!

Lastly, this is about detecting unexpected changes. Verifying whether expected changes work is another story beyond the scope of unit (and template) testing.