OSDN Git Service

trunk整理
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / virtualservice / virtualservice-36.sh
1 #!/bin/bash
2
3 . ${SET_DEFAULT_CONF}
4
5 # Run sorryserver (send in 5 sec)
6 PATH=$PATH:$COMMON_SCRIPT_DIR
7 test_server -p 20000 -t 5 ./materials/virtualservice-36-response.txt &
8
9 # temp file
10 tmp_file="/tmp/`uuidgen`.log"
11
12 cleanup() {
13         killall test_server
14         killall test_client2
15         rm $tmp_file
16 }
17
18 #Add Service
19 start_l7vsd || exit 1
20
21 $L7VSADM -A -t 127.0.0.1:40001 -m sessionless -b 127.0.0.1:20000
22 if [ $? -ne 0 ]; then
23         cleanup
24         echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m sessionless -b 127.0.0.1:20000"
25         exit 1
26 fi
27
28 test_client2 -p 40001 > $tmp_file &
29
30 sleep 5
31
32 $L7VSADM -a -t 127.0.0.1:40001 -m sessionless -r 127.0.0.1:30000
33 if [ $? -ne 0 ]; then
34         cleanup
35         echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m sessionless -r 127.0.0.1:30000"
36         exit 1
37 fi
38
39 sleep 5
40
41 # sorry server connection must be left
42 ps aux | grep "test_client2" | grep -v grep > /dev/null 2>&1
43 if [ $? -ne 0 ]; then
44         cleanup
45         echo "Test failed: sorry server connection not found."
46         exit 1
47 fi
48
49 sleep 5
50
51 diff $tmp_file ./materials/virtualservice-36-response.txt > /dev/null 2>&1
52 if [ $? -ne 0 ]; then
53         cleanup
54         echo "Test failed: Mismatch sorryserver response."
55         exit 1
56 fi
57
58 cleanup
59 exit 0
60