forked from redhat-cop/helm-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.test.sh
executable file
·76 lines (59 loc) · 1.43 KB
/
.test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
trap "exit 1" TERM
export TOP_PID=$$
export project_name="gitops-operator-$(date +'%d%m%Y')"
install() {
echo "install - $(pwd)"
oc new-project ${project_name}
helm upgrade --install argocd --set namespaces={${project_name}} -f values.yaml --namespace ${project_name}
}
test() {
echo "test - $(pwd)"
timeout 2m bash <<"EOT"
run() {
echo "Attempting oc -n openshift-gitops get deployment/cluster"
while [[ $(oc get deployment/cluster -o name -n openshift-gitops) != 'deployment.apps/cluster' ]]; do
sleep 10
done
}
run
EOT
oc rollout status deployment/argocd-server -n ${project_name} --watch=true
timeout 2m bash <<"EOT"
run() {
host=$(oc get route/argocd-server -o jsonpath='{.spec.host}' -n ${project_name})
echo "Attempting $host"
while [[ $(curl -L -k -s -o /dev/null -w '%{http_code}' https://${host}) != '200' ]]; do
sleep 10
done
}
run
EOT
if [[ $? != 0 ]]; then
echo "CURL timed-out. Failing"
host=$(oc get route/argocd-server -o jsonpath='{.spec.host}' -n ${project_name})
curl -L -k -vvv "https://${host}"
exit 1
fi
echo "Test complete"
}
cleanup() {
echo "cleanup - $(pwd)"
helm uninstall argocd --namespace ${project_name}
oc delete project/${project_name}
}
# Process arguments
case $1 in
install)
install
;;
test)
test
;;
cleanup)
cleanup
;;
*)
echo "Not an option"
exit 1
esac