Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add pod labels to the server-test.yaml #1094

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions templates/tests/server-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ metadata:
namespace: {{ include "vault.namespace" . }}
annotations:
"helm.sh/hook": test
{{- with .Values.server.extraLabels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- include "imagePullSecrets" . | nindent 2 }}
containers:
Expand Down
26 changes: 26 additions & 0 deletions test/unit/server-test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,29 @@ load _helpers
yq -r 'map(select(.name=="FOOBAR")) | .[] .value' | tee /dev/stderr)
[ "${name}" = "foobar" ]
}

# ----------------------------------------------------------------------
# extraLabels

@test "server/standalone=server-test-Pod: specify extraLabels" {
cd `chart_dir`

local actual=$(helm template \
--show-only templates/tests/server-test.yaml \
--set 'server.extraLabels.foo=bar' \
. | tee /dev/stderr |
yq -r '.metadata.labels.foo' | tee /dev/stderr)

[ "${actual}" = "bar" ]
}

@test "server/standalone=server-test-Pod: no extraLabels set" {
cd `chart_dir`

local actual=$(helm template \
--show-only templates/tests/server-test.yaml \
. | tee /dev/stderr |
yq -r '.metadata.labels // "null"' | tee /dev/stderr)

[ "${actual}" = "null" ]
}
Loading