forked from ibm-cloud-architecture/refarch-kc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-integration-tests.sh
executable file
·59 lines (45 loc) · 2.72 KB
/
run-integration-tests.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
#!/bin/bash
SCRIPTLOC="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# 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 --all
kubectl scale deployment --replicas=1 -n shipping --all
# Wait for services to restart
kubectl rollout status -n shipping deployment springcontainerms-deployment
kubectl rollout status -n shipping deployment fleetms-deployment
kubectl rollout status -n shipping deployment kc-ui-deployment
kubectl rollout status -n shipping deployment order-command-ms
kubectl rollout status -n shipping deployment order-query-ms
kubectl rollout status -n shipping deployment voyagesms-deployment
# 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 --all
kubectl scale deployment --replicas=1 -n shipping --all
# Wait for services to restart
kubectl rollout status -n shipping deployment springcontainerms-deployment
kubectl rollout status -n shipping deployment fleetms-deployment
kubectl rollout status -n shipping deployment kc-ui-deployment
kubectl rollout status -n shipping deployment order-command-ms
kubectl rollout status -n shipping deployment order-query-ms
kubectl rollout status -n shipping deployment voyagesms-deployment