-
Notifications
You must be signed in to change notification settings - Fork 880
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding helm test for vault server (#531)
Also adds acceptance test for 'helm test' and updates the chart-verifier version.
- Loading branch information
Showing
5 changed files
with
93 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{{- if .Values.server.enabled }} | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: "{{ .Release.Name }}-server-test" | ||
namespace: {{ .Release.Namespace }} | ||
annotations: | ||
"helm.sh/hook": test | ||
spec: | ||
containers: | ||
- name: {{ .Release.Name }}-server-test | ||
image: {{ .Values.server.image.repository }}:{{ .Values.server.image.tag | default "latest" }} | ||
imagePullPolicy: {{ .Values.server.image.pullPolicy }} | ||
env: | ||
- name: VAULT_ADDR | ||
value: {{ include "vault.scheme" . }}://{{ template "vault.fullname" . }}.{{ .Release.Namespace }}.svc:{{ .Values.server.service.port }} | ||
command: | ||
- /bin/sh | ||
- -c | ||
- | | ||
echo "Checking for sealed info in 'vault status' output" | ||
ATTEMPTS=10 | ||
n=0 | ||
until [ "$n" -ge $ATTEMPTS ] | ||
do | ||
echo "Attempt" $n... | ||
vault status -format yaml | grep -E '^sealed: (true|false)' && break | ||
n=$((n+1)) | ||
sleep 5 | ||
done | ||
if [ $n -ge $ATTEMPTS ]; then | ||
echo "timed out looking for sealed info in 'vault status' output" | ||
exit 1 | ||
fi | ||
exit 0 | ||
restartPolicy: Never | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bats | ||
|
||
load _helpers | ||
|
||
@test "helm/test: running helm test" { | ||
cd `chart_dir` | ||
|
||
kubectl delete namespace acceptance --ignore-not-found=true | ||
kubectl create namespace acceptance | ||
kubectl config set-context --current --namespace=acceptance | ||
|
||
helm install "$(name_prefix)" . | ||
wait_for_running $(name_prefix)-0 | ||
|
||
helm test "$(name_prefix)" | ||
} | ||
|
||
# Clean up | ||
teardown() { | ||
if [[ ${CLEANUP:-true} == "true" ]] | ||
then | ||
echo "helm/pvc teardown" | ||
helm delete vault | ||
kubectl delete --all pvc | ||
kubectl delete namespace acceptance --ignore-not-found=true | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters