OSDN Git Service

add test script
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / l7directord / l7directord-4-4-27.sh
1 #!/bin/bash
2 . ${SET_DEFAULT_CONF}
3 \cp ./materials/l7directord-4-4-27-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
4
5 #Run http server
6 RealServer1=RealServer1
7 RealServer1_ADDR=127.0.0.1
8 RealServer1_PORT=50001
9 start_lighttpd -s $RealServer1 -a $RealServer1_ADDR -p $RealServer1_PORT -l ${L7VS_LOG_DIR}/l7directord-4-4-27-real1-access.log -S
10
11 if [ $? -ne 0 ]
12 then
13         echo "Test failed: start_lighttpd RealServer1"
14         exit 1
15 fi
16
17 RealServer2=RealServer2
18 RealServer2_ADDR=127.0.0.1
19 RealServer2_PORT=50002
20 start_lighttpd -s $RealServer2 -a $RealServer2_ADDR -p $RealServer2_PORT -l ${L7VS_LOG_DIR}/l7directord-4-4-27-real2-access.log -S
21
22 if [ $? -ne 0 ]
23 then
24         echo "Test failed: start_lighttpd RealServer2"
25         exit 1
26 fi
27
28 echo "test" > ${TMP_DIR}/100M.dat
29 set_lighttpd_content $RealServer1 ${TMP_DIR}/100M.dat
30 set_lighttpd_content $RealServer2 ${TMP_DIR}/100M.dat
31
32 # Start l7vsd
33 $L7VSD
34 if [ $? -ne 0 ]
35 then
36         echo "Test failed: $L7VSD"
37         exit 1
38 fi
39 usleep 100000
40
41 # Start l7directord
42 $INIT_L7DIRECTORD start 
43 if [ $? -ne 0 ]
44 then
45         echo "Test failed: $INIT_L7DIRECTORD start"
46         exit 1
47 fi
48 sleep 5
49
50 dd if=/dev/zero of=${TMP_DIR}/100M.dat bs=1024 count=102400
51 set_lighttpd_content $RealServer1 ${TMP_DIR}/100M.dat
52 set_lighttpd_content $RealServer2 ${TMP_DIR}/100M.dat
53 sleep 30
54
55 $INIT_L7DIRECTORD stop
56 if [ $? -ne 0 ]
57 then
58         echo "Test failed: $INIT_L7DIRECTORD stop"
59         exit 1
60 fi
61
62 RET=`cat ${L7VS_LOG_DIR}/l7directord.log | grep "\[WRN1102\] Service check NG. HTTP response is not ok. Response status line is .500 SSL read timeout: ' (real - .127.0.0.1:50001')"`
63 if [ -z "$RET" ]
64 then
65         echo "Test failed: ${L7VS_LOG_DIR}/l7directord.log"
66         exit 1
67 fi
68
69 RET=`cat ${L7VS_LOG_DIR}/l7directord.log | grep "\[WRN1102\] Service check NG. HTTP response is not ok. Response status line is .500 SSL read timeout: ' (real - .127.0.0.1:50002')"`
70 if [ -z "$RET" ]
71 then
72         echo "Test failed: ${L7VS_LOG_DIR}/l7directord.log"
73         exit 1
74 fi
75
76 exit 0
77