-
Notifications
You must be signed in to change notification settings - Fork 0
/
siege_test_nocache.sh
executable file
·42 lines (34 loc) · 1.14 KB
/
siege_test_nocache.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
#!/bin/bash
SIEGE_URLS_FILE="siegeurls.txt"
SIEGE_LOG_FILE="siege.log"
TEST_FAILED=0
PORT=8080
ADDR=localhost
cat <<EOL > $SIEGE_URLS_FILE
http://${ADDR}:${PORT}/
http://${ADDR}:${PORT}/nonexistent
http://${ADDR}:${PORT}/cgi/hello.py?name=Marvin
http://${ADDR}:${PORT}/cgi/hello.php?name=Marvin
http://${ADDR}:${PORT}/cgi/hello.js?name=Marvin
http://${ADDR}:${PORT}/cgi/post.py POST {"name": "Marvin"}
http://${ADDR}:${PORT}/cgi/post.php POST {"name": "Marvin"}
http://${ADDR}:${PORT}/cgi/post.js POST {"name": "Marvin"}
EOL
cat $SIEGE_URLS_FILE > $SIEGE_LOG_FILE
printf "\n" >> $SIEGE_LOG_FILE
siege > /dev/null 2>&1
echo "Running siege without caching"
echo "Running siege without caching" >> $SIEGE_LOG_FILE
siege -v -t 10s -c 25 -b -H "Cache-Control: no-cache" -f $SIEGE_URLS_FILE >> $SIEGE_LOG_FILE
if grep -q '"failed_transactions": *[1-9]' $SIEGE_LOG_FILE; then
echo "!!!KO!!!: Siege test failed without caching. Check $SIEGE_LOG_FILE for details."
TEST_FAILED=1
else
echo "OK: Siege test passed without caching."
fi
printf "\n"
if [ "$TEST_FAILED" -ne 0 ]; then
printf "\n!!!KO!!!: One or more tests failed.\n\n"
exit 1
fi
printf "\n"