diff --git a/.github/workflows/helm.yaml b/.github/workflows/helm.yaml index a9f63b34f..fbfe0465b 100644 --- a/.github/workflows/helm.yaml +++ b/.github/workflows/helm.yaml @@ -42,6 +42,14 @@ jobs: with: version: v3.7.0 + - name: Install Helm Unit Test Plugin + run: | + helm plugin install https://github.com/helm-unittest/helm-unittest + + - name: Run Helm Unit Tests + run: | + helm unittest charts/descheduler --strict -d + - name: Run chart-testing (list-changed) id: list-changed run: | diff --git a/charts/descheduler/tests/.gitignore b/charts/descheduler/tests/.gitignore new file mode 100644 index 000000000..bae41db43 --- /dev/null +++ b/charts/descheduler/tests/.gitignore @@ -0,0 +1 @@ +__snapshot__ diff --git a/charts/descheduler/tests/cronjob_test.yaml b/charts/descheduler/tests/cronjob_test.yaml new file mode 100644 index 000000000..3a3d7e195 --- /dev/null +++ b/charts/descheduler/tests/cronjob_test.yaml @@ -0,0 +1,17 @@ +suite: Test Descheduler CronJob + +templates: + - "*.yaml" + +release: + name: descheduler + +set: + kind: CronJob + +tests: + - it: creates CronJob when kind is set + template: templates/cronjob.yaml + asserts: + - isKind: + of: CronJob diff --git a/charts/descheduler/tests/deployment_test.yaml b/charts/descheduler/tests/deployment_test.yaml new file mode 100644 index 000000000..fa4d62be4 --- /dev/null +++ b/charts/descheduler/tests/deployment_test.yaml @@ -0,0 +1,49 @@ +suite: Test Descheduler Deployment + +templates: + - "*.yaml" + +release: + name: descheduler + +set: + kind: Deployment + +tests: + - it: creates Deployment when kind is set + template: templates/deployment.yaml + asserts: + - isKind: + of: Deployment + + - it: enables leader-election + set: + leaderElection: + enabled: true + template: templates/deployment.yaml + asserts: + - contains: + path: spec.template.spec.containers[0].args + content: --leader-elect=true + + - it: support leader-election resourceNamespace + set: + leaderElection: + enabled: true + resourceNamespace: test + template: templates/deployment.yaml + asserts: + - contains: + path: spec.template.spec.containers[0].args + content: --leader-elect-resource-namespace=test + + - it: support legacy leader-election resourceNamescape + set: + leaderElection: + enabled: true + resourceNamescape: typo + template: templates/deployment.yaml + asserts: + - contains: + path: spec.template.spec.containers[0].args + content: --leader-elect-resource-namespace=typo