-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathrun-integration-tests.bat
59 lines (45 loc) · 2.76 KB
/
run-integration-tests.bat
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
@ECHO OFF
SET SCRIPTLOC=%~dp0
:: This script will modify the Kafka topic configuration to use topics prefixed 'itg-'
:: before running the tests, and then reset the topics when finished.
:: Delete old integration job, if it exists
kubectl delete -f %SCRIPTLOC%\..\..\itg-tests\es-it\ReeferItgTests.yaml -n shipping
:: Deploy integration Kafka topics
kubectl apply -f %SCRIPTLOC%\itg-kafka-topics-configmap.yaml -n shipping
kubectl apply -f %SCRIPTLOC%\itg-topics.yaml -n kafka
:: Configure BPM to use mockup instance
kubectl apply -f %SCRIPTLOC%\itg-bpm-configmap.yaml -n shipping
:: Restart services so that they are configured with the new topic names
kubectl scale deployment --replicas=0 -n shipping -l app.kubernetes.io/part-of=refarch-kc
kubectl scale deployment --replicas=1 -n shipping -l app.kubernetes.io/part-of=refarch-kc
:: Wait for services to restart
kubectl rollout status -n shipping deployment spring-container-ms
kubectl rollout status -n shipping deployment fleet-ms
kubectl rollout status -n shipping deployment kc-ui
kubectl rollout status -n shipping deployment order-command-ms
kubectl rollout status -n shipping deployment order-query-ms
kubectl rollout status -n shipping deployment voyages-ms
:: Deploy integration tests job
sed -e's#value: "IBMCLOUD#value: "LOCAL#' %SCRIPTLOC%\..\..\itg-tests\es-it\ReeferItgTests.yaml > %SCRIPTLOC%\..\..\itg-tests\es-it\ReeferItgTests.yaml.local
kubectl apply -f %SCRIPTLOC%\..\..\itg-tests\es-it\ReeferItgTests.yaml.local -n shipping
:: Wait for job pod to be ready (ie. job has started running)
:: This will take seconds, unless the image needs pulling from a remote registry.
kubectl wait --for=condition=ready pod -l job-name=reefer-itgtests-job -n shipping --timeout 180s
:: Follow the job log
kubectl logs job/reefer-itgtests-job -n shipping -f
:: Wait for job completion (just in case network is interrupted while following log)
kubectl wait --for=condition=complete job reefer-itgtests-job -n shipping --timeout 600s
:: Deploy normal Kafka topics
kubectl apply -f %SCRIPTLOC%\kafka-topics-configmap.yaml -n shipping
:: Restore BPM config
kubectl apply -f %SCRIPTLOC%\bpm-configmap.yaml -n shipping
:: Restart services so that they are configured with the new topic names
kubectl scale deployment --replicas=0 -n shipping -l app.kubernetes.io/part-of=refarch-kc
kubectl scale deployment --replicas=1 -n shipping -l app.kubernetes.io/part-of=refarch-kc
:: Wait for services to restart
kubectl rollout status -n shipping deployment spring-container-ms
kubectl rollout status -n shipping deployment fleet-ms
kubectl rollout status -n shipping deployment kc-ui
kubectl rollout status -n shipping deployment order-command-ms
kubectl rollout status -n shipping deployment order-query-ms
kubectl rollout status -n shipping deployment voyages-ms