-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtests.sh
executable file
·101 lines (80 loc) · 1.75 KB
/
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
# find json-search here: https://github.com/cosmo-ray/json-search
set -e
abort()
{
echo >&2 '
***************
*** ABORTED ***
***************
'
echo "An error occurred. Exiting..." >&2
exit 1
}
trap 'abort' 0
cd ruby
echo "--- Ruby tests ---"
echo -n "example01"
ruby example01.rb | grep Services > /dev/null
echo " ok !"
echo -n "example02"
ruby example02.rb | grep Vms > /dev/null
echo " ok !"
echo -n "example03"
ruby example03.rb | grep NetId > /dev/null
echo " ok !"
cd ..
cd c
echo "--- C tests ---"
echo "compile"
make clean
make
echo -n "example01"
./example01 | grep Images > /dev/null
echo " ok !"
echo -n "example02"
./example02 > out
echo [ $( sed s/}{/},{/g out ) ] > out
json-search "SecurityGroup" out > /dev/null # check create
json-search "SecurityGroups" out > /dev/null # check read
# test 3 request have been executed
[ $(cat out | json-search "RequestId" | wc -l) == "5" ]
rm out
echo " ok !"
echo -n "example03"
./example03 | grep ServiceName > /dev/null
echo " ok !"
cd ..
cd rust
echo "--- Rust Test ---"
echo "example01"
cargo run --example example01 | json-search "City" > /dev/null
echo " ok !"
echo "example02"
cargo run --example example02 | json-search "City" > /dev/null
echo " ok !"
echo "example03"
cargo run --example example03 | json-search "Vms" > /dev/null
echo " ok !"
cd ..
cd nodejs
echo "--- Nodejs Test ---"
echo -n "example01 "
node example01 | json-search "ServiceName" > /dev/null
echo " ok !"
echo -n "example02 "
node example02 | json-search "Vms" > /dev/null
echo " ok !"
cd ..
cd python
echo "--- Python tests ---"
echo "example01 "
python3 -m venv env
source env/bin/activate
pip install -e .
python example01.py "key" "value" | grep tag > /dev/null
echo "ok !"
deactivate
cd ..
cd ..
trap - 0