OSDN Git Service

bug fix
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / virtualservice / virtualservice-150.sh
1 #!/bin/bash
2
3 # set config file
4 . ${SET_DEFAULT_CONF}
5 \cp -f materials/virtualservice-150-l7vs.cf ${L7VSD_CONF_DIR}/l7vs.cf
6 \cp -f materials/virtualservice-150-sslproxy.target.cf ${L7VSD_CONF_DIR}/sslproxy/sslproxy.target.cf
7
8 #Run http server
9 RealServer1=RealServer1
10 RealServer1_ADDR=127.0.0.1
11 RealServer1_PORT=50001
12 start_lighttpd -s $RealServer1 -a $RealServer1_ADDR -p $RealServer1_PORT
13
14 if [ $? -ne 0 ]
15 then
16         echo "Test failed: start_lighttpd RealServer1"
17         exit 1
18 fi
19
20 #Add Service
21 $L7VSD
22 if [ $? -ne 0 ]
23 then
24         echo "Test failed: $L7VSD"
25         exit 1
26 fi
27 usleep 100000
28
29 $L7VSADM -A -t 127.0.0.1:40001 -m sessionless -z ${L7VSD_CONF_DIR}/sslproxy/sslproxy.target.cf
30 if [ $? -ne 0 ]
31 then
32         echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m sessionless -z ${L7VSD_CONF_DIR}/sslproxy/sslproxy.target.cf"
33         exit 1
34 fi
35
36 $L7VSADM -a -t 127.0.0.1:40001 -m sessionless -r ${RealServer1_ADDR}:${RealServer1_PORT}
37 if [ $? -ne 0 ]
38 then
39         echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m sessionless -r ${RealServer1_ADDR}:${RealServer1_PORT}"
40         exit 1
41 fi
42
43 for (( i = 0 ; i < 4; i++ )){
44         RET=`wget -qO- https://127.0.0.1:40001/ --no-check-certificate`
45         if [ "${RET}" != "${RealServer1}" ]
46         then
47                 echo "Test failed: wget -qO- https://127.0.0.1:40001/ --no-check-certificate"
48                 exit 1
49         fi
50 }
51
52 RET=`cat ${L7VS_LOG_DIR}/l7vsd.log | grep "SSL session cache information: Session number\[2\]"`
53 if [ -z "${RET}" ]
54 then
55         echo "Test failed: cat ${L7VS_LOG_DIR}/l7vsd.log"
56         exit 1
57 fi
58
59 stop_lighttpd $RealServer1
60
61 exit 0
62