OSDN Git Service

eb193341f4ae2cc8382611ecc766c3159a70927e
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / l7directord / l7directord-4-4-17.sh
1 #!/bin/bash
2 . ${SET_DEFAULT_CONF}
3 \cp ./materials/l7directord-4-4-17-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
4
5 # Run server (sleep 0 sec. 200 OK)
6 PATH=$PATH:$COMMON_SCRIPT_DIR
7 test_server -p 20000 ./materials/l7directord-4-4-17-response.txt &
8
9 # Start l7vsd
10 start_l7vsd
11 if [ $? -ne 0 ]; then
12         pkill test_server
13         exit 1
14 fi
15
16 # Start l7directord
17 start_l7directord
18 if [ $? -ne 0 ]; then
19         pkill test_server
20         exit 1
21 fi
22
23 # wait health check
24 sleep 2
25
26 # [WRN0203] Service check OK. HTTP response is valid. HTTP response status line is `200 OK'
27 grep "WRN0203.*200 OK" ${L7VS_LOG_DIR}/l7directord.log > /dev/null 2>&1
28 if [ $? -ne 0 ]; then
29         pkill test_server
30         echo "Test failed: Cannot find '200 OK' health check log"
31         exit 1
32 fi
33
34 # Run server (spend 5 sec. 200 OK)
35 test_server -p 20000 -t 5 ./materials/l7directord-4-4-17-response.txt &
36
37 sleep 5
38
39 # [WRN1102] Service check NG. HTTP response is not ok. Response status line is ...
40 grep "WRN1102" ${L7VS_LOG_DIR}/l7directord.log > /dev/null 2>&1
41 if [ $? -ne 0 ]; then
42         pkill test_server
43         echo "Test failed: Cannot find health check timeout log"
44         exit 1
45 fi
46
47 # Stop l7directord
48 stop_l7directord || exit 1
49
50 exit 0