forked from helm/charts
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consul - Add consul tests and upgrade consul to 0.8.x (helm#1126)
* Bump consul version to 0.8.3 Add app version tag Update chart maintainers to github username Add consul helm tests Update documentation Remove existing test.sh * Update helm test command in notes
- Loading branch information
Showing
7 changed files
with
77 additions
and
41 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
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
1. Watch all cluster members come up. | ||
$ kubectl get pods --namespace={{ .Release.Namespace }} -w | ||
2. Confirm consul cluster is healthy | ||
$ kubectl exec {{ .Release.Name }}-consul-0 consul members --namespace={{ .Release.Namespace }} | grep server | ||
2. Test cluster health using Helm test. | ||
$ helm test {{ .Release.Name }} | ||
3. (Optional) Manually confirm consul cluster is healthy. | ||
$ kubectl exec {{ .Release.Name }}-consul-0 consul members --namespace={{ .Release.Namespace }} | grep server |
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,38 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: "{{.Release.Name}}-ui-test-{{ randAlphaNum 5 | lower }}" | ||
annotations: | ||
"helm.sh/hook": test-success | ||
"pod.beta.kubernetes.io/init-containers": '[ | ||
{ | ||
"name": "test-framework", | ||
"image": "dduportal/bats:0.4.0", | ||
"command": ["bash", "-c", " | ||
set -ex\n | ||
# copy bats to tools dir\n | ||
cp -R /usr/local/libexec/ /tools/bats/\n | ||
"], | ||
"volumeMounts": [ | ||
{"name": "tools", "mountPath": "/tools"} | ||
] | ||
} | ||
]' | ||
spec: | ||
containers: | ||
- name: {{.Release.Name}}-ui-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 "fullname" . }}-tests | ||
- name: tools | ||
emptyDir: {} | ||
restartPolicy: Never |
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,16 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "fullname" . }}-tests | ||
data: | ||
run.sh: |- | ||
@test "Testing Consul cluster has quorum" { | ||
for i in {0..2}; do | ||
if [ `kubectl exec {{.Release.Name}}-consul-$i consul members --namespace={{.Release.Namespace}} | grep server | wc -l` -ge "3" ]; then | ||
echo "{{.Release.Name}}-consul-$i OK. consul members returning at least 3 records." | ||
else | ||
echo "{{.Release.Name}}-consul-$i ERROR. consul members returning less than 3 records." | ||
exit 1 | ||
fi | ||
done | ||
} |
This file was deleted.
Oops, something went wrong.
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