OSDN Git Service

trunk整理
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / library-logger / logger-1.sh
1 #!/bin/bash
2
3 # set config file
4 cp materials/logger-1-l7vs.cf ${L7VSD_CONF_DIR}/l7vs.cf
5
6 #Run http server
7 RealServer1=RealServer1
8 RealServer1_ADDR=127.0.0.1
9 RealServer1_PORT=50001
10 start_lighttpd -s $RealServer1 -a $RealServer1_ADDR -p $RealServer1_PORT
11
12 if [ $? -ne 0 ]
13 then
14         echo "Test failed: start_lighttpd RealServer1"
15         exit 1  
16 fi
17
18 #Add Service
19 $L7VSD
20 if [ $? -ne 0 ]
21 then
22         echo "Test failed: $L7VSD"
23         exit 1
24 fi
25
26 usleep 100000
27 $L7VSADM -A -t 127.0.0.1:40001 -m sessionless
28 if [ $? -ne 0 ]
29 then
30         echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m sessionless"
31         exit 1
32 fi
33
34 $L7VSADM -a -t 127.0.0.1:40001 -m sessionless -r ${RealServer1_ADDR}:${RealServer1_PORT}
35 if [ $? -ne 0 ]
36 then
37         echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m sessionless -r ${RealServer1_ADDR}:${RealServer1_PORT}"
38         exit 1
39 fi
40
41 #Connect
42 RET=`wget -t 1 -qO- http://127.0.0.1:40001/`
43 if [ "${RET}" != "${RealServer1}" ]
44 then
45         echo "Test failed: wget -t 1 -qO- http://127.0.0.1:40001/"
46         exit 1
47 fi
48
49 RET=`wget -t 1 -qO- http://127.0.0.1:40001/`
50 if [ "${RET}" != "${RealServer1}" ]
51 then
52         echo "Test failed: wget -t 1 -qO- http://127.0.0.1:40001/"
53         exit 1
54 fi
55
56 RET=`wget -t 1 -qO- http://127.0.0.1:40001/`
57 if [ "${RET}" != "${RealServer1}" ]
58 then
59         echo "Test failed: wget -t 1 -qO- http://127.0.0.1:40001/"
60         exit 1
61 fi
62
63 stop_lighttpd $RealServer1
64
65 RET=`cat ${L7VS_LOG_DIR}/l7vsd.log | grep "\[DEBUG\]" | wc -l`
66 if [ ${RET} -le 0 ]
67 then
68         echo "Test failed: cat ${L7VS_LOG_DIR}/l7vsd.log"
69         exit 1
70 fi
71
72 RET=`cat ${L7VS_LOG_DIR}/l7vsadm.log | grep "\[DEBUG\]" | wc -l`
73 if [ ${RET} -le 0 ]
74 then
75         echo "Test failed: cat ${L7VS_LOG_DIR}/l7vsadm.log"
76         exit 1
77 fi
78
79 exit 0
80