This repository has been archived by the owner on Apr 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathrun_vcwallet_ui_automation.sh
executable file
·79 lines (65 loc) · 2.21 KB
/
run_vcwallet_ui_automation.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
77
78
79
#!/usr/bin/env bash
#
# Copyright SecureKey Technologies Inc. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
echo "Running $0"
ROOT=`pwd`
npm -v
echo "starting containers..."
cd $ROOT/test/fixtures/wallet-web
(source .env && docker-compose -f docker-compose-demo.yml -f docker-compose-server.yml -f docker-compose-web.yml down && docker-compose -f docker-compose-demo.yml -f docker-compose-server.yml -f docker-compose-web.yml up --force-recreate -d)
sleep 40
echo "running healthcheck..."
# healthCheck function
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
AQUA=$(tput setaf 6)
NONE=$(tput sgr0)
healthCheck() {
sleep 1
n=0
maxAttempts=60
if [ "" != "$4" ]
then
maxAttempts=$4
fi
echo "running health check : app=$1 url=$2 timeout=$maxAttempts seconds"
until [ $n -ge $maxAttempts ]
do
response=$(curl -H 'Cache-Control: no-cache' -o /dev/null -s -w "%{http_code}" --insecure "$2")
if [ "$response" == "$3" ]
then
echo "${GREEN}$1 $2 is up ${NONE}"
break
fi
n=$((n+1))
if [ $n -eq $maxAttempts ]
then
echo "${RED}failed health check : app=$1 url=$2 responseCode=$response ${NONE}"
fi
sleep 1
done
}
# healthcheck
healthCheck vcwallet https://vcwallet.trustbloc.local:8071/healthcheck 200
healthCheck hub-auth https://auth.trustbloc.local:8044/healthcheck 200
healthCheck hub-auth-hydra https://auth-hydra.trustbloc.local:5555/.well-known/openid-configuration 200
healthCheck mock-adapter https://demo-adapter.trustbloc.local:8094/verifier 200
healthCheck mediator https://mediator.trustbloc.local:10093/healthcheck 200
healthCheck demo-hydra https://demo-hydra.trustbloc.local:7777/.well-known/openid-configuration 200
healthCheck demo-login-app http://localhost:3300/login 200
echo "running tests..."
cd $ROOT/test/ui-automation
npm run test-vcwallet
if [ $? -ne 0 ]
then
cd $ROOT/test/fixtures/wallet-web
docker-compose -f docker-compose-demo.yml -f docker-compose-server.yml -f docker-compose-web.yml logs --no-color >& docker-compose.log
exit 1
fi
echo "stopping containers..."
cd $ROOT/test/fixtures/wallet-web
(source .env && docker-compose -f docker-compose-demo.yml -f docker-compose-server.yml -f docker-compose-web.yml down --remove-orphans)