forked from redhat-cop/helm-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.test.sh
executable file
·60 lines (47 loc) · 1.1 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
#!/usr/bin/env bash
trap "exit 1" TERM
export TOP_PID=$$
export argocd_link_name="argocd-server-$(date +'%d%m%Y')"
export nexus_link_name="nexus-$(date +'%d%m%Y')"
install() {
echo "install - $(pwd)"
helm template helper-console-links --skip-tests --values values.yaml --set-string section[0].urls[0].name=${argocd_link_name} --set-string section[0].urls[1].name=${nexus_link_name} . | oc apply -f -
}
test() {
echo "test - $(pwd)"
timeout 2m bash <<"EOT"
run() {
echo "Attempting oc get consolelink/${argocd_link_name}"
while [[ $(oc get consolelink/${argocd_link_name} -o name) != "consolelink.console.openshift.io/${argocd_link_name}" ]]; do
sleep 10
done
}
run
EOT
if [[ $? != 0 ]]; then
echo "OC timed-out. Failing"
oc get consolelink
exit 1
fi
echo "Test complete"
}
cleanup() {
echo "cleanup - $(pwd)"
oc delete consolelink/${argocd_link_name}
oc delete consolelink/${nexus_link_name}
}
# Process arguments
case $1 in
install)
install
;;
test)
test
;;
cleanup)
cleanup
;;
*)
echo "Not an option"
exit 1
esac