diff --git a/README.md b/README.md index 909ebcb..be7a88b 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,32 @@ helm repo add opencost https://opencost.github.io/opencost-helm-chart See the [Chart Documentation](https://github.com/opencost/opencost-helm-chart/blob/main/charts/opencost/README.md) for chart install instructions. +## Testing + +[Testing](https://github.com/helm-unittest/helm-unittest) your chart (optional) + +Presumes you've got Helm unittest installed: (i.e. `helm plugin install unittest`) and that your in the root directory of your cloned repo: + +```console +helm unittest charts/opencost +``` +Should produce a result like this: + +``` +### Chart [ opencost ] charts/opencost + + PASS test deployment charts/opencost/tests/deployment_test.yaml + PASS test deployment snapshot charts/opencost/tests/opencost_test.yaml + +Charts: 1 passed, 1 total +Test Suites: 2 passed, 2 total +Tests: 2 passed, 2 total +Snapshot: 1 passed, 1 total +Time: 31.011089ms +``` + +*** + ## OpenCost Links * [OpenCost](https://github.com/opencost/opencost) * [Documentation](https://www.opencost.io/docs/) diff --git a/charts/opencost/Chart.yaml b/charts/opencost/Chart.yaml index 5b7d65d..64c63c5 100755 --- a/charts/opencost/Chart.yaml +++ b/charts/opencost/Chart.yaml @@ -9,7 +9,7 @@ keywords: - kubecost - opencost - monitoring -version: 1.22.1 +version: 1.22.2 maintainers: - name: mattray url: https://mattray.dev diff --git a/charts/opencost/tests/deployment_test.yaml b/charts/opencost/tests/deployment_test.yaml new file mode 100644 index 0000000..f865889 --- /dev/null +++ b/charts/opencost/tests/deployment_test.yaml @@ -0,0 +1,16 @@ +suite: test deployment +templates: + - templates/deployment.yaml +tests: + - it: should work + set: + image.tag: latest + asserts: + - isKind: + of: Deployment + - matchRegex: + path: metadata.name + pattern: -opencost$ + - matchRegex: + path: spec.template.spec.containers[0].image + pattern: quay\.io\/kubecost1\/kubecost-cost-model:prod-[0-9]*\.[0-9]*\.[0-9]* diff --git a/charts/opencost/tests/opencost_test.yaml b/charts/opencost/tests/opencost_test.yaml new file mode 100644 index 0000000..bd84e6a --- /dev/null +++ b/charts/opencost/tests/opencost_test.yaml @@ -0,0 +1,7 @@ +suite: test deployment snapshot +templates: + - templates/deployment.yaml +tests: + - it: pod spec should match snapshot + asserts: + - matchSnapshot: {}