From ea1c36922b8c807bb39deb3a14bef4123aecaf73 Mon Sep 17 00:00:00 2001 From: Marco Lecheler Date: Wed, 23 Aug 2023 20:30:35 +0200 Subject: [PATCH] chore(test): use vault.fullname in Helm test (#912) --- templates/tests/server-test.yaml | 2 +- test/unit/server-test.bats | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/templates/tests/server-test.yaml b/templates/tests/server-test.yaml index 2c577aa24..20e2e5a5a 100644 --- a/templates/tests/server-test.yaml +++ b/templates/tests/server-test.yaml @@ -9,7 +9,7 @@ SPDX-License-Identifier: MPL-2.0 apiVersion: v1 kind: Pod metadata: - name: "{{ .Release.Name }}-server-test" + name: {{ template "vault.fullname" . }}-server-test namespace: {{ include "vault.namespace" . }} annotations: "helm.sh/hook": test diff --git a/test/unit/server-test.bats b/test/unit/server-test.bats index de82f84c3..314703a5d 100644 --- a/test/unit/server-test.bats +++ b/test/unit/server-test.bats @@ -37,6 +37,33 @@ load _helpers #-------------------------------------------------------------------- +@test "server/standalone-server-test-Pod: default metadata.name" { + cd `chart_dir` + local actual=$(helm template \ + --show-only templates/tests/server-test.yaml \ + . | tee /dev/stderr | + yq -r '.metadata.name' | tee /dev/stderr) + [ "${actual}" = "release-name-vault-server-test" ] +} + +@test "server/standalone-server-test-Pod: release metadata.name vault" { + cd `chart_dir` + local actual=$(helm template vault \ + --show-only templates/tests/server-test.yaml \ + . | tee /dev/stderr | + yq -r '.metadata.name' | tee /dev/stderr) + [ "${actual}" = "vault-server-test" ] +} + +@test "server/standalone-server-test-Pod: release metadata.name foo" { + cd `chart_dir` + local actual=$(helm template foo \ + --show-only templates/tests/server-test.yaml \ + . | tee /dev/stderr | + yq -r '.metadata.name' | tee /dev/stderr) + [ "${actual}" = "foo-vault-server-test" ] +} + @test "server/standalone-server-test-Pod: default server.standalone.enabled" { cd `chart_dir` local actual=$(helm template \