{"id":13676343,"url":"https://github.com/helm-unittest/helm-unittest","last_synced_at":"2026-02-19T09:14:24.490Z","repository":{"id":39725722,"uuid":"112146910","full_name":"helm-unittest/helm-unittest","owner":"helm-unittest","description":"BDD styled unit test framework for Kubernetes Helm charts as a Helm plugin.","archived":false,"fork":false,"pushed_at":"2026-02-13T07:04:11.000Z","size":3232,"stargazers_count":1261,"open_issues_count":79,"forks_count":307,"subscribers_count":8,"default_branch":"main","last_synced_at":"2026-02-13T13:50:08.826Z","etag":null,"topics":["hacktoberfest","hacktoberfest2025","helm","helm-chart","helm-plugin","kubernetes","testing","unittest"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/helm-unittest.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-11-27T04:24:55.000Z","updated_at":"2026-02-13T07:04:16.000Z","dependencies_parsed_at":"2023-02-14T23:30:56.317Z","dependency_job_id":"669f5aae-d7e4-48a8-ab63-bf17e48abcdf","html_url":"https://github.com/helm-unittest/helm-unittest","commit_stats":null,"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"purl":"pkg:github/helm-unittest/helm-unittest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helm-unittest%2Fhelm-unittest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helm-unittest%2Fhelm-unittest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helm-unittest%2Fhelm-unittest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helm-unittest%2Fhelm-unittest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helm-unittest","download_url":"https://codeload.github.com/helm-unittest/helm-unittest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helm-unittest%2Fhelm-unittest/sbom","scorecard":{"id":1236858,"data":{"date":"2025-09-02T07:32:16Z","repo":{"name":"github.com/helm-unittest/helm-unittest","commit":"d974f233a8c0f930eb94f79ff241e681e6a26fb3"},"scorecard":{"version":"v5.2.1","commit":"ab2f6e92482462fe66246d9e32f642855a691dc1"},"score":7.8,"checks":[{"name":"Dependency-Update-Tool","score":10,"reason":"update tool detected","details":["Info: detected update tool: Dependabot: .github/dependabot.yml:1"],"documentation":{"short":"Determines if the project uses a dependency update tool.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#dependency-update-tool"}},{"name":"Code-Review","score":5,"reason":"Found 4/8 approved changesets -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#dangerous-workflow"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Info: Found linked content: SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#security-policy"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":10,"reason":"30 commit(s) and 11 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":10,"reason":"all dependencies are pinned","details":["Info:  18 out of  18 GitHub-owned GitHubAction dependencies pinned","Info:  13 out of  13 third-party GitHubAction dependencies pinned","Info:   3 out of   3 containerImage dependencies pinned","Info:   1 out of   1 goCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql.yml:31","Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql.yml:32","Warn: jobLevel 'checks' permission set to 'write': .github/workflows/go.yml:23","Warn: jobLevel 'statuses' permission set to 'write': .github/workflows/go.yml:93","Warn: jobLevel 'contents' permission set to 'write': .github/workflows/release.yml:21","Warn: jobLevel 'contents' permission set to 'write': .github/workflows/release.yml:69","Info: jobLevel 'contents' permission set to 'read': .github/workflows/scorecards.yml:29","Info: jobLevel 'actions' permission set to 'read': .github/workflows/scorecards.yml:30","Info: topLevel 'contents' permission set to 'read': .github/workflows/codeql.yml:24","Info: topLevel 'contents' permission set to 'read': .github/workflows/dependency-review.yml:13","Info: topLevel 'contents' permission set to 'read': .github/workflows/go.yml:16","Info: topLevel 'contents' permission set to 'read': .github/workflows/release.yml:9","Info: topLevel permissions set to 'read-all': .github/workflows/scorecards.yml:18"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":5,"reason":"badge detected: Passing","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#cii-best-practices"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v1.0.0 not signed: https://api.github.com/repos/helm-unittest/helm-unittest/releases/236416875","Warn: release artifact v0.8.2 not signed: https://api.github.com/repos/helm-unittest/helm-unittest/releases/217803606","Warn: release artifact v0.8.1 not signed: https://api.github.com/repos/helm-unittest/helm-unittest/releases/210473842","Warn: release artifact v0.8.0 not signed: https://api.github.com/repos/helm-unittest/helm-unittest/releases/203727768","Warn: release artifact v0.7.2 not signed: https://api.github.com/repos/helm-unittest/helm-unittest/releases/197036740","Warn: release artifact v1.0.0 does not have provenance: https://api.github.com/repos/helm-unittest/helm-unittest/releases/236416875","Warn: release artifact v0.8.2 does not have provenance: https://api.github.com/repos/helm-unittest/helm-unittest/releases/217803606","Warn: release artifact v0.8.1 does not have provenance: https://api.github.com/repos/helm-unittest/helm-unittest/releases/210473842","Warn: release artifact v0.8.0 does not have provenance: https://api.github.com/repos/helm-unittest/helm-unittest/releases/203727768","Warn: release artifact v0.7.2 does not have provenance: https://api.github.com/repos/helm-unittest/helm-unittest/releases/197036740"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#signed-releases"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/release.yml:66"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#packaging"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#license"}},{"name":"Vulnerabilities","score":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2025-3887 / GHSA-9h84-qmv7-982p","Warn: Project is vulnerable to: GO-2025-3888 / GHSA-f9f8-9pmf-xv68"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":10,"reason":"SAST tool is run on all commits","details":["Info: SAST configuration detected: CodeQL","Info: all commits (30) are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#sast"}},{"name":"Branch-Protection","score":4,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'main'","Info: 'force pushes' disabled on branch 'main'","Info: 'branch protection settings apply to administrators' is required to merge on branch 'main'","Info: 'stale review dismissal' is required to merge on branch 'main'","Warn: branch 'main' does not require approvers","Warn: codeowners review is not required on branch 'main'","Warn: 'last push approval' is disabled on branch 'main'","Info: 'up-to-date branches' is required to merge on branch 'main'","Info: status check found to merge onto on branch 'main'","Info: PRs are required in order to make changes on branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#branch-protection"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#fuzzing"}},{"name":"CI-Tests","score":10,"reason":"14 out of 14 merged PRs checked by a CI test -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project runs tests before pull requests are merged.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#ci-tests"}},{"name":"Contributors","score":10,"reason":"project has 33 contributing companies or organizations","details":["Info: found contributions from: cloud-foundry, cloudkats, cloudkats @gitops-hub, dalet-cncf, experimentlabs, gofogo, ik-ansible, ik-automation, ik-bounty, ik-c, ik-cloud, ik-cloud-iam, ik-crypto, ik-dotnet, ik-infrastructure-testing, ik-kubernetes, ik-learning, ik-monitoring, ik-network-analyzers, ik-networking, ik-performance, ik-project-management, ik-python, ik-scripting, ik-security, ik-serverless, ik-terraform, ik-vms-dockers, ik-windows, ik-workshop, sumologic, terraform-helm-module, terraform-module"],"documentation":{"short":"Determines if the project has a set of contributors from multiple organizations (e.g., companies).","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#contributors"}}]},"last_synced_at":"2025-09-03T00:15:26.504Z","repository_id":39725722,"created_at":"2025-09-03T00:15:26.504Z","updated_at":"2025-09-03T00:15:26.504Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29609524,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","hacktoberfest2025","helm","helm-chart","helm-plugin","kubernetes","testing","unittest"],"created_at":"2024-08-02T13:00:23.319Z","updated_at":"2026-02-19T09:14:24.473Z","avatar_url":"https://github.com/helm-unittest.png","language":"Go","funding_links":[],"categories":["Go","Kubernetes","testing"],"sub_categories":["Kubernetes templating"],"readme":"# helm unittest\n\n[![Release](https://img.shields.io/github/v/release/helm-unittest/helm-unittest)](https://github.com/helm-unittest/helm-unittest/releases)\n[![Github Actions](https://github.com/helm-unittest/helm-unittest/actions/workflows/go.yml/badge.svg)](https://github.com/helm-unittest/helm-unittest/actions)\n[![License](https://img.shields.io/github/license/helm-unittest/helm-unittest)](https://github.com/helm-unittest/helm-unittest/blob/main/LICENSE)\n[![Go Report Card](https://goreportcard.com/badge/github.com/helm-unittest/helm-unittest)](https://goreportcard.com/report/github.com/helm-unittest/helm-unittest)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=helm-unittest_helm-unittest\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=helm-unittest_helm-unittest)\n[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/9365/badge)](https://www.bestpractices.dev/projects/9365)\n[![OpenSSF](https://api.scorecard.dev/projects/github.com/helm-unittest/helm-unittest/badge)](https://scorecard.dev/viewer/?uri=github.com/helm-unittest/helm-unittest)\n\nUnit test for _helm chart_ in YAML to keep your chart consistent and robust!\n\nFeature:\n\n- write test file in pure YAML\n- render locally\n- create **nothing** on your cluster\n- [wildcard selection for templates](./DOCUMENT.md#test-suite)\n- [define values and release options](./DOCUMENT.md#test-job)\n- [snapshot testing](#snapshot-testing)\n- [test suite code completion and validation](#test-suite-code-completion-and-validation)\n\n## Documentation\n\nIf you are ready for writing tests, check the [DOCUMENT](./DOCUMENT.md) for the test API in YAML.\n\n- [Install](#install)\n- [Docker Usage](#docker-usage)\n- [Get Started](#get-started)\n- [Test Suite File](#test-suite-file)\n  - [Templated Test Suites](#templated-test-suites)\n- [Usage](#usage)\n  - [Flags](#flags)\n  - [Yaml JsonPath Support](#yaml-jsonpath-support)\n  - [DocumentSelector](#documentselector)\n- [Example](#example)\n  - [Open Source Community Examples](#open-source-community-examples)\n- [Snapshot Testing](#snapshot-testing)\n- [Dependent subchart Testing](#dependent-subchart-testing)\n- [Tests within subchart](#tests-within-subchart)\n- [Test suite code completion and validation](#test-suite-code-completion-and-validation)\n- [Frequently Asked Questions](#frequently-asked-questions)\n- [Related Projects / Commands](#related-projects--commands)\n- [Contributing](#contributing)\n\n## Install\n\n```\n$ helm plugin install https://github.com/helm-unittest/helm-unittest.git\n```\n\nIt will install the latest version of binary into helm plugin directory.\n\n## Docker Usage\n\n```\n# run help of latest helm with latest helm unittest plugin\ndocker run -ti --rm -v $(pwd):/apps helmunittest/helm-unittest\n\n# run help of specific helm version with specific helm unittest plugin version\ndocker run -ti --rm -v $(pwd):/apps helmunittest/helm-unittest:3.11.1-0.3.0\n\n# run unittests of a helm 3 chart\n# make sure to mount local folder to /apps in container\ndocker run -ti --rm -v $(pwd):/apps helmunittest/helm-unittest:3.11.1-0.3.0 .\n\n# run unittests of a helm 3 chart with Junit output for CI validation\n# make sure to mount local folder to /apps in container\n# the test-output.xml will be available in the local folder.\ndocker run -ti --rm -v $(pwd):/apps helmunittest/helm-unittest:3.11.1-0.3.0 -o test-output.xml -t junit .\n```\n\nThe docker container contains the fully installed helm client, including the helm-unittest plugin.\n\n## Get Started\n\nAdd `tests` in `.helmignore` of your chart, and create the following test file at `$YOUR_CHART/tests/deployment_test.yaml`:\n\n```yaml\nsuite: test deployment\ntemplates:\n  - deployment.yaml\ntests:\n  - it: should work\n    set:\n      image.tag: latest\n    asserts:\n      - isKind:\n          of: Deployment\n      - matchRegex:\n          path: metadata.name\n          pattern: -my-chart$\n      - equal:\n          path: spec.template.spec.containers[0].image\n          value: nginx:latest\n```\n\nand run:\n\n```\n$ helm unittest $YOUR_CHART\n```\n\nNow there is your first test! ;)\n\n## Test Suite File\n\nThe test suite file is written in pure YAML, and default placed under the `tests/` directory of the chart with suffix `_test.yaml`. You can also have your own suite files arrangement with `-f, --file` option of cli set as the glob patterns of test suite files related to chart directory, like:\n\n```bash\n$ helm unittest -f 'my-tests/*.yaml' -f 'more-tests/**/*.yaml' my-chart\n```\n\nCheck [DOCUMENT](./DOCUMENT.md) for more details about writing tests.\n\n### Templated Test Suites\n\nYou may find yourself needing to set up a lots o tests that are a parameterization of a single test. For instance, let's say that you deploy to 3 environments `env = dev | staging | prod`.\n\nIn order to do this, you can actually write your tests as a helm chart as well. If you go about this route, you\nmust set the `--chart-tests-path` option. Once you have done so, helm unittest will run a standard helm render\nagainst the values.yaml in your specified directory.\n\n```\n/my-chart\n  /tests-chart\n    /Chart.yaml\n    /values.yaml\n    /templates\n      /per_env_snapshots.yaml\n\n  /Chart.yaml\n  /values.yaml\n  /.helmignore\n  /templates\n    /actual_template.yaml\n```\n\nIn the above example file structure, you would maintain a helm chart that will render out against the Chart.yaml\nthat as provided and the values.yaml. With rendered charts, any test suite that is generated is automatically ran\nwe do not look for a file postfix or glob.\n\n**Note:** since you can create multiple suites in a single template file, you must provide the suite name, since we can no longer use the test suite file name meaningfully.\n\n**Note 2:** since you can be running against subcharts and multiple charts, you need to make sure that you do not designate your `--chart-tests-path` to be the same folder as your other tests. This is because we will try to render those non-helm test folders and fail during the unit test.\n\n**Note 3:** for snapshot tests, you will need to provide a helm ignore that ignores `*/__snapshot__/*`. Otherwise, subsequent runs will try to render those snapshots.\n\nThe command for the above chart and test configuration would be:\n\n```shell\nhelm unittest --chart-tests-path tests-chart my-chart\n```\n\n## Usage\n\n```\n$ helm unittest [flags] CHART [...]\n```\n\nThis renders your charts locally (without tiller) and runs tests\ndefined in test suite files.\n\n### Flags\n\n```\n      --color                  enforce printing colored output even stdout is not a tty. Set to false to disable color\n      --strict                 strict parse the testsuites (default false)\n  -d  --debugPlugin            enable debug logging (default false)\n  -v, --values stringArray     absolute or glob paths of values files location to override helmchart values\n  -f, --file stringArray       glob paths of test files location, default to tests\\*_test.yaml (default [tests\\*_test.yaml])\n  -q, --failfast               direct quit testing, when a test is failed (default false)\n  -h, --help                   help for unittest\n  -t, --output-type string     the file-format where testresults are written in, accepted types are (JUnit, NUnit, XUnit) (default XUnit)\n  -o, --output-file string     the file where testresults are written in format specified, defaults no output is written to file\n  -u, --update-snapshot        update the snapshot cached if needed, make sure you review the change before update\n  -s, --with-subchart charts   include tests of the subcharts within charts folder (default true)\n      --chart-tests-path string the folder location relative to the chart where a helm chart to render test suites is located\n```\n\n### Yaml JsonPath Support\n\nNow JsonPath is supported for mappings and arrays.\nThis makes it possible to find items in an array, based on JsonPath.\nFor more detail on the [`jsonPath`](https://github.com/vmware-labs/yaml-jsonpath#syntax) syntax.\n\nDue to the change to JsonPath, the map keys in `path` containing periods (`.`) or special characters (`/`) are now supported with the use of `\"\"`:\n\n```yaml\n- equal:\n    path: metadata.annotations[\"kubernetes.io/ingress.class\"]\n    value: nginx\n```\n\nThe next releases it will be possible to validate multiple paths when JsonPath result into multiple results.\n\n### DocumentSelector\n\nThe test job or assertion can also specify a documentSelector rather than a documentIndex. Note that the documentSelector will always override a documentIndex if a match is found. This field is particularly useful when helm produces multiple templates and the order is not always guaranteed.\n\nThe `path` in the documentSelector has Yaml JsonPath Support, using JsonPath expressions it is possible to filter on multiple fields.\n\nThe `value` in the documentSelector can validate complete yaml objects and is optional. \n\n```yaml\n...\ntests:\n  - it: should pass\n    values:\n      - ./values/staging.yaml\n    set:\n      image.pullPolicy: Always\n      resources:\n        limits:\n          memory: 128Mi\n    template: deployment.yaml\n    documentSelector:\n      path: metadata.name\n      value: my-service-name\n    asserts:\n      - equal:\n          path: metadata.name\n          value: my-deploy\n```\n\n## Example\n\nCheck [`test/data/v3/basic/`](./test/data/v3/basic) for some basic use cases of a simple chart.\n\n### Open Source Community Examples\n\n\u003e Open-source solutions that uses helm-unittest to improve helm and kubernetes experience\n\n- [Traefik: kubernetes ingress](https://github.com/traefik/traefik-helm-chart/tree/master/traefik/tests)\n- [Prometheus: community charts](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack/unittests)\n- [Grafana: kubernetes monitoring](https://github.com/grafana/k8s-monitoring-helm/tree/main/charts/k8s-monitoring)\n- [HiveMQ: mqtt platform](https://github.com/hivemq/helm-charts/tree/develop/charts/hivemq-platform/tests)\n- [Gitlab runner](https://gitlab.com/gitlab-org/charts/gitlab-runner/-/tree/main/tests?ref_type=heads)\n- [External DNS: kubernetes-sigs/external-dns](https://github.com/kubernetes-sigs/external-dns/tree/master/charts/external-dns/tests)\n\n## Snapshot Testing\n\nSometimes you may just want to keep the rendered manifest not changed between changes without every details asserted. That's the reason for snapshot testing! Check the tests below:\n\n```yaml\ntemplates:\n  - templates/deployment.yaml\ntests:\n  - it: pod spec should match snapshot\n    asserts:\n      - matchSnapshot:\n          path: spec.template.spec\n  # or you can snapshot the whole manifest\n  - it: manifest should match snapshot\n    asserts:\n      - matchSnapshot: {}\n  - it: manifest should match snapshot and pattern and not match another pattern\n    asserts:\n      - matchSnapshot:\n          matchRegex:\n            pattern: .*app.*\n          notMatchRegex:\n              pattern: .*bcde.*\n```\n\nThe `matchSnapshot` assertion validate the content rendered the same as cached last time. It fails if the content changed, and you should check and update the cache with `-u, --update-snapshot` option of cli.\n\n```\n$ helm unittest -u my-chart\n```\n\nThe cache files is stored as `__snapshot__/*_test.yaml.snap` at the directory your test file placed, you should add them in version control with your chart.\n\n## Dependent subchart Testing\n\nIf you have hard dependency subcharts (installed via `helm dependency`) existed in `charts` directory (they don't need to be extracted), it is possible to unittest these from the root chart. This feature can be helpful to validate if good default values are accidentally overwritten within your default helm chart.\n\n```yaml\n# $YOUR_CHART/tests/xxx_test.yaml\ntemplates:\n  - charts/postgresql/templates/xxx.yaml\ntests:\n  - it:\n    set:\n      # this time required to prefix with \"postgresql.\"\n      postgresql.somevalue: should_be_scoped\n    asserts:\n      - ...\n```\n\nNote 1: if dependent subcharts uses an alias, use the alias name in the templates.\nNote 2: using the folder structure in templates can also be used to unittest templates which are placed in subfolders or unittest subcharts from the rootchart.\n\nCheck [`test/data/v3/with-subchart/`](./test/data/v3/with-subchart) as an example.\n\n## Tests within subchart\n\nIf you have customized hard dependency subchart (not installed via `helm dependency`, but added manually) existed in `charts` directory, tests inside would also be executed by default. You can disable this behavior by setting `--with-subchart=false` flag in cli, thus only the tests in root chart will be executed. Notice that the values defined in subchart tests will be automatically scoped, you don't have to add dependency scope yourself:\n\n```yaml\n# with-subchart/charts/child-chart/tests/xxx_test.yaml\ntemplates:\n  - templates/xxx.yaml\ntests:\n  - it:\n    set:\n      # no need to prefix with \"child-chart.\"\n      somevalue: should_be_scoped\n    asserts:\n      - ...\n```\n\nCheck [`test/data/v3/with-subchart/`](./test/data/v3/with-subchart) as an example.\n\n## Test Suite code completion and validation\n\nMost popular IDEs (IntelliJ, Visual Studio Code, etc.) support applying schemas to YAML files using a JSON Schema. This provides comprehensive documentation as well as code completion while editing the test-suite file:\n\n![Code completion](./.images/testsuite-yaml-codecompletion.png)\n\nIn addition, test-suite files can be validated while editing so wrongfully added additional properties or incorrect data types can be detected while editing:\n\n![Code Validation](./.images/testsuite-yaml-codevalidation.png)\n\n### Visual Studio Code\n\nWhen developing with VSCode, the very popular YAML plug-in (created by RedHat) allows adding references to schemas by adding a comment line on top of the file:\n\n```yaml\n# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json\nsuite: http-service.configmap_test.yaml\ntemplates: [configmap.yaml]\nrelease:\n  name: test-release\n  namespace: TEST_NAMESPACE\n```\n\nAlternatively, you can add the schema globally to the IDE, using a well defined pattern:\n\n```json\n\"yaml.schemas\": {\n  \"https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json\": [\"charts/*/tests/*_test.yaml\"]\n}\n```\n\n### IntelliJ\n\nSimilar to VSCode, IntelliJ allows mapping file patterns to schemas via preferences: Languages \u0026 Frameworks -\u003e Schemas and DTDs -\u003e JSON Schema Mappings\n\n![Add Json Schema](./.images/testsuite-yaml-addschema-intellij.png)\n\n## Frequently Asked Questions\n\nAs more people use the unittest plugin, more questions will come. Therefore a [Frequently Asked Question page](./FAQ.md) is created to answer the most common questions.\n\nIf you are missing an answer to a question, feel free to raise a ticket.\n\n## Related Projects / Commands\n\nThis plugin is inspired by [helm-template](https://github.com/technosophos/helm-template), and the idea of snapshot testing and some printing format comes from [jest](https://github.com/facebook/jest).\n\nAnd there are some other helm commands you might want to use:\n\n- [`helm template`](https://helm.sh/docs/helm/helm_template/): render the chart and print the output.\n\n- [`helm lint`](https://helm.sh/docs/helm/helm_lint/): examines a chart for possible issues, useful to validate chart dependencies.\n\n- [`helm test`](https://helm.sh/docs/helm/helm_test/): test a release with testing pod defined in chart. Note this does create resources on your cluster to verify if your release is correct. Check the [doc](https://github.com/helm/helm/blob/main/pkg/chart/v2/chart_test.go).\n\nAlternatively, you can also use generic tests frameworks:\n\n- Python - [pytest-helm-charts](https://pypi.org/project/pytest-helm-charts/)\n\n- Go - [terratest](https://blog.gruntwork.io/automated-testing-for-kubernetes-and-helm-charts-using-terratest-a4ddc4e67344)\n\n## License\n\nMIT\n\n## Contributing\n\nIssues and PRs are welcome!\nTo start developing this plugin please follow the [Contribution](./CONTRIBUTING.md) guidelines.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelm-unittest%2Fhelm-unittest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelm-unittest%2Fhelm-unittest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelm-unittest%2Fhelm-unittest/lists"}