Open kuskoman opened 2 months ago
Thanks for this PR, sounds good to me. But Kubernetes service has not test yet, can I ask you to add the 2 following changes:
configs/helm/tests/values/with_service.yaml
that will be used to set an annotation in tests:service:
annotations:
annotation1: value1
configs/helm/tests/service_test.yaml
to test the Kubernetes service# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
---
suite: grafana dashboard tests
templates:
- service.yaml
tests:
- it: render default service
asserts:
- isKind:
of: Service
- hasDocuments:
count: 1
- it: with custom service
values:
- ./values/with_service.yaml
asserts:
- equal:
path: metadata.annotations.annotation1
value: value1
With this configuration, we'll test in the CI that Kubernetes service return is valid according to the Kubernetes api.
@vmercierfr wow, i haven't noticed the tests for helm chart. since it is MIT licensed repository it is definitely something i will be looking to "steal" into my OS repos 😄 i will update the code in a moment
i modified it, but i have trouble running unit tests on my local machine. i've installed the unittest plugin but it is throwing errors:
In order to merge the PR, @kuskoman can you sign all your commits (git rebase HEAD~3 --signoff
) ?
See Github Reference
ahh, i signed 3rd part commits by mistake, lemme fix that
@vmercierfr since i started from your current head with just a single commit, could you rerun the tests just to make sure? now the branch should be in the correct state
Tests are ok:
helm unittest configs/helm
2024/06/28 15:49:17 found symbolic link in path: /Users/vincent.mercier/Documents/github/kuskoman/prometheus-rds-exporter/configs/helm/LICENSE resolves to /Users/vincent.mercier/Documents/github/kuskoman/prometheus-rds-exporter/LICENSE. Contents of linked file included and used
2024/06/28 15:49:17 found symbolic link in path: /Users/vincent.mercier/Documents/github/kuskoman/prometheus-rds-exporter/configs/helm/grafana_dashboards resolves to /Users/vincent.mercier/Documents/github/kuskoman/prometheus-rds-exporter/configs/grafana/public. Contents of linked file included and used
### Chart [ prometheus-rds-exporter-chart ] configs/helm
PASS deployment tests configs/helm/tests/deployment_test.yaml
PASS grafana dashboard tests configs/helm/tests/grafanadashboard_test.yaml
PASS service tests configs/helm/tests/service_test.yaml
PASS service account tests configs/helm/tests/serviceaccount_test.yaml
PASS service monitor tests configs/helm/tests/servicemonitor_test.yaml
Charts: 1 passed, 1 total
Test Suites: 5 passed, 5 total
Tests: 16 passed, 16 total
Snapshot: 0 passed, 0 total
Time: 85.865375ms
But git commits are not correctly signed; you should have a verified
icon of your commits.
Can you check your commits signature?
sre