-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathrun.sh
executable file
·52 lines (43 loc) · 1.41 KB
/
run.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
#!/bin/sh
# test all the HTTP service implementations (python, java, ruby)
# and make sure their responses are the same while avoiding a
# byzantine failure
# (uses cloudi_service_quorum to make sure that less than 1/3rd of the
# processes fail (the default configuration has 12 processes))
FAILED=0
for FILE in `ls input`
do
# -H "Transfer-Encoding: chunked"
# text requests
rm -f tmp/$FILE
/usr/bin/env curl -X POST -H "Content-Type: text/plain" -s \
--data-ascii @input/$FILE -o tmp/$FILE \
--compressed \
http://localhost:6466/byzantine/tests/http/$FILE
if [ ! -f output/$FILE ]; then
echo "output/$FILE missing"
continue
fi
test -f tmp/$FILE && cmp -s tmp/$FILE output/$FILE
if [ $? -ne 0 ]; then
echo "input/$FILE request failed"
FAILED=1
fi
# compressed requests
if [ -f input.zip/$FILE ]; then
rm -f tmp/$FILE
/usr/bin/env curl -X POST -H "Content-Type: application/zip" -s \
--data-binary @input.zip/$FILE -o tmp/$FILE \
--compressed \
http://localhost:6466/byzantine/tests/http/$FILE
test -f tmp/$FILE && cmp -s tmp/$FILE output/$FILE
if [ $? -ne 0 ]; then
echo "input.zip/$FILE request failed"
FAILED=1
fi
fi
done
if [ $FAILED -eq 0 ]; then
echo \
"All tests were successful! (no Byzantine failures handling HTTP requests)"
fi