Fix up helm test
to use the local client
This commit is contained in:
parent
9ef4efc5c4
commit
52e069d67f
3 changed files with 23 additions and 42 deletions
|
@ -1,9 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "consul.fullname" . }}-tests
|
||||
data:
|
||||
run.sh: |-
|
||||
@test "Testing Consul cluster has quorum" {
|
||||
[ `kubectl exec {{ template "consul.fullname" . }}-server-0 consul members --namespace={{ .Release.Namespace }} | grep server | wc -l` -ge "3" ]
|
||||
}
|
|
@ -1,37 +1,31 @@
|
|||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: "{{ .Release.Name }}-test-{{ randAlphaNum 5 | lower }}"
|
||||
name: "{{ template "consul.fullname" . }}-test-{{ randAlphaNum 5 | lower }}"
|
||||
labels:
|
||||
app: {{ template "consul.name" . }}
|
||||
chart: {{ template "consul.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
annotations:
|
||||
"helm.sh/hook": test-success
|
||||
spec:
|
||||
initContainers:
|
||||
- name: test-framework
|
||||
image: dduportal/bats:0.4.0
|
||||
command:
|
||||
- "bash"
|
||||
- "-c"
|
||||
- |
|
||||
set -ex
|
||||
# copy bats to tools dir
|
||||
cp -R /usr/local/libexec/ /tools/bats/
|
||||
volumeMounts:
|
||||
- mountPath: /tools
|
||||
name: tools
|
||||
containers:
|
||||
- name: {{ .Release.Name }}-test
|
||||
image: {{ .Values.test.image }}:{{ .Values.test.imageTag }}
|
||||
command: ["/tools/bats/bats", "-t", "/tests/run.sh"]
|
||||
volumeMounts:
|
||||
- mountPath: /tests
|
||||
name: tests
|
||||
readOnly: true
|
||||
- mountPath: /tools
|
||||
name: tools
|
||||
volumes:
|
||||
- name: tests
|
||||
configMap:
|
||||
name: {{ template "consul.fullname" . }}-tests
|
||||
- name: tools
|
||||
emptyDir: {}
|
||||
- name: consul-test
|
||||
image: "{{ .Values.global.image }}"
|
||||
env:
|
||||
- name: HOST_IP
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.hostIP
|
||||
command:
|
||||
- "/bin/sh"
|
||||
- "-ec"
|
||||
- |
|
||||
export VALUE="{{randAlphaNum 24 | lower }}"
|
||||
export CONSUL_HTTP_ADDR="${HOST_IP}:8500"
|
||||
consul kv delete _consul_helm_test
|
||||
consul kv put _consul_helm_test $VALUE
|
||||
[ `consul kv get _consul_helm_test` = "$VALUE" ]
|
||||
consul kv delete _consul_helm_test
|
||||
restartPolicy: Never
|
||||
|
|
|
@ -152,7 +152,3 @@ connectInject:
|
|||
# defaults but can be customized if necessary.
|
||||
certName: tls.crt
|
||||
keyName: tls.key
|
||||
|
||||
test:
|
||||
image: lachlanevenson/k8s-kubectl
|
||||
imageTag: v1.4.8-bash
|
||||
|
|
Loading…
Reference in a new issue