test: align the file names of the helm unit tests with the chart conventions

The chart conventions demand camelCase file names, forbid short names like `svc` and require the unit tests to
mirror the template structure. The unit tests followed none of that consistently. Four casings existed side by
side - camelCase (extraInitContainers.yaml), kebab-case (checksum-annotations.yaml), a snake and kebab mix
(init_directory_structure.sh-rootless.yaml) and all caps (HA.yaml) - so there was no pattern to copy when
adding a suite, which is how the inconsistency kept growing.

Three groups of problems are fixed:

- svc-configuration.yaml used exactly the short name the conventions forbid for files and keys.
- Several file names repeated their own directory, for example deployment/deployment-additional-config.yaml and
  metric-secret/metrics-secret-servicemonitor-disabled.yaml, which names the subject three times. The directory
  already carries that information, so the file name now only carries the scenario. The default scenario of a
  template is named basics.yaml.
- Four suites lived in a directory of a template they do not assert on. They were filed under deployment/
  because the deployment is rendered as a side effect, not because it is the subject:

      deployment/deprecations.yaml                -> deprecation/deployment.yaml
      deployment/inline-config.yaml               -> config/inlineConfig.yaml
      deployment/storage-class-configuration.yaml -> persistentVolumeClaim/storageClass.yaml
      deployment/svc-configuration.yaml           -> service/configuration.yaml

  storage-class-configuration.yaml is the clearest case: a persistentVolumeClaim directory already existed next
  to it. The suite titles of the two suites whose subject changed are adjusted accordingly.

The Makefile passed `--file unittests/helm/values-conflicting-checks.yaml`, but that file does not exist in the
tree. `helm unittest` ignores a missing path without a warning, so the flag has been dead for an unknown amount
of time while still suggesting the checks run. It is removed; the `unittests/helm/**/*.yaml` glob would pick
the file up anyway if it ever returns.

The naming rule is written down in the copilot instructions, together with the constraint that the glob matches
only a single directory level, so a suite can never be placed directly in unittests/helm/.

All 49 suites and 267 tests still pass.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-10-03 22:19:39 +02:00
co-authored by Copilot
parent fef4190a74
commit eeacda2a25
42 changed files with 5 additions and 4 deletions
+2 -1
View File
@@ -52,8 +52,9 @@ data:
### Unit Tests ### Unit Tests
- Helm unit tests live in `unittests/helm/` mirroring the template structure. - Helm unit tests live in `unittests/helm/` mirroring the template structure. A suite belongs into the directory of the template it asserts on, never into the directory of a template it only renders as a side effect.
- Test files are YAML using the [helm-unittest](https://github.com/helm-unittest/helm-unittest) format. - Test files are YAML using the [helm-unittest](https://github.com/helm-unittest/helm-unittest) format.
- Name test files in camelCase after the scenario they cover (e.g. `signingEnabled.yaml`), use `basics.yaml` for the default scenario and do not repeat the directory name in the file name. The `make helm/unittest` glob only matches one directory level, so every suite must live in a subdirectory.
- Each test must set all required values explicitly — do not rely on cross-test state. - Each test must set all required values explicitly — do not rely on cross-test state.
- The `values.yaml` file must pass `yamllint`. The configuration is in `.yamllint.yaml`. Use `make yamllint` to run the linter. - The `values.yaml` file must pass `yamllint`. The configuration is in `.yamllint.yaml`. Use `make yamllint` to run the linter.
- The title of the unit test should clearly describe the scenario being tested. As title must be use a short sentence starting with a capital letter and ending without a period. - The title of the unit test should clearly describe the scenario being tested. As title must be use a short sentence starting with a capital letter and ending without a period.
+1 -1
View File
@@ -39,7 +39,7 @@ helm/dependency-update:
# ============================================================================== # ==============================================================================
PHONY+=helm/unittest PHONY+=helm/unittest
helm/unittest: helm/unittest:
helm unittest --strict --file 'unittests/helm/**/*.yaml' --file 'unittests/helm/values-conflicting-checks.yaml' ./ helm unittest --strict --file 'unittests/helm/**/*.yaml' ./
# BASH PREPARE # BASH PREPARE
# ============================================================================== # ==============================================================================
@@ -1,4 +1,4 @@
suite: Test deployment inline config suite: Test config inlineConfig
release: release:
name: gitea-unittests name: gitea-unittests
namespace: testing namespace: testing
@@ -3,7 +3,7 @@ chart:
release: release:
name: gitea-unittests name: gitea-unittests
namespace: testing namespace: testing
suite: Test deployment storage class configuration suite: Test persistentVolumeClaim storage class
templates: templates:
- templates/persistentVolumeClaim.yaml - templates/persistentVolumeClaim.yaml
tests: tests: