-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathtest-check.sh
executable file
·53 lines (42 loc) · 1.3 KB
/
test-check.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
#
#!/bin/bash
function readJson {
UNAMESTR=`uname`
if [[ "$UNAMESTR" == 'Linux' ]]; then
SED_EXTENDED='-r'
elif [[ "$UNAMESTR" == 'Darwin' ]]; then
SED_EXTENDED='-E'
fi;
VALUE=`grep -m 1 "\"${2}\"" ${1} | sed ${SED_EXTENDED} 's/^ *//;s/.*: *"//;s/",?//'`
if [ ! "$VALUE" ]; then
echo "Error: Cannot find \"${2}\" in ${1}" >&2;
exit 1;
else
echo $VALUE ;
fi;
}
aws cloudformation set-type-configuration \
--region $REGION \
--type RESOURCE \
--type-name $RESOURCE_NAME \
--configuration-alias default \
--configuration file://typeConfiguration.json
aws cloudformation test-type --type RESOURCE --type-name $RESOURCE_NAME --log-delivery-bucket $BUCKET_NAME> test_arn.json
TEST_ARN=`readJson test_arn.json TypeVersionArn` || exit 1;
echo $TEST_ARN
aws cloudformation describe-type --arn $TEST_ARN > test-result.json
TEST_STATUS=`readJson test-result.json TypeTestsStatus` || exit 1;
while [ $TEST_STATUS = "IN_PROGRESS" ]; do
sleep 60
aws cloudformation describe-type --arn $TEST_ARN > test-result.json
TEST_STATUS=`readJson test-result.json TypeTestsStatus` || exit 1;
echo $TEST_STATUS
done
if [ $TEST_STATUS = "PASSED" ]; then
echo $TEST_STATUS
echo $TEST_STATUS > test_result.txt
else
echo $TEST_STATUS
echo $TEST_STATUS > test_result.txt
exit 1
fi