Increase testability of shell scripts (#752)

This is a preparation for #724 (bash script testing) which would be too complex to review if done there.

Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/752
Co-authored-by: justusbunsi <sk.bunsenbrenner@gmail.com>
Co-committed-by: justusbunsi <sk.bunsenbrenner@gmail.com>
This commit is contained in:
2024-12-19 12:04:00 +00:00
committed by justusbunsi
parent 726b36c6d8
commit a79fd31f7e
7 changed files with 32 additions and 8 deletions

View File

@ -29,3 +29,19 @@ tests:
path: spec.template.metadata.labels
content:
hello: world
- it: "injects TMP_EXISTING_ENVS_FILE as environment variable to 'init-app-ini' init container"
template: templates/gitea/deployment.yaml
asserts:
- contains:
path: spec.template.spec.initContainers[1].env
content:
name: TMP_EXISTING_ENVS_FILE
value: /tmp/existing-envs
- it: "injects ENV_TO_INI_MOUNT_POINT as environment variable to 'init-app-ini' init container"
template: templates/gitea/deployment.yaml
asserts:
- contains:
path: spec.template.spec.initContainers[1].env
content:
name: ENV_TO_INI_MOUNT_POINT
value: /env-to-ini-mounts

View File

@ -28,6 +28,8 @@ tests:
value:
- name: GNUPGHOME
value: /data/git/.gnupg
- name: TMP_RAW_GPG_KEY
value: /raw/private.asc
- equal:
path: spec.template.spec.initContainers[2].volumeMounts
value:

View File

@ -19,7 +19,7 @@ tests:
#!/usr/bin/env bash
set -eu
gpg --batch --import /raw/private.asc
gpg --batch --import "$TMP_RAW_GPG_KEY"
- it: skips gpg script block for disabled signing
asserts:
- equal:

View File

@ -20,7 +20,7 @@ tests:
#!/usr/bin/env bash
set -eu
gpg --batch --import /raw/private.asc
gpg --batch --import "$TMP_RAW_GPG_KEY"
- it: skips gpg script block for disabled signing
set:
image.rootless: false