Skip to content

Commit

Permalink
chore(test): use vault.fullname in Helm test (#912)
Browse files Browse the repository at this point in the history
  • Loading branch information
fty4 authored Aug 23, 2023
1 parent c7353d1 commit ea1c369
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion templates/tests/server-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions test/unit/server-test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit ea1c369

Please sign in to comment.