OSDN Git Service

trunk整理
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / l7directord / l7directord-4-4-16.sh
diff --git a/test/script/l7directord/l7directord-4-4-16.sh b/test/script/l7directord/l7directord-4-4-16.sh
new file mode 100755 (executable)
index 0000000..e6ed38f
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/bash
+. ${SET_DEFAULT_CONF}
+\cp ./materials/l7directord-4-4-16-l7directord.cf ${L7DIRECTORD_CONF_DIR}/l7directord.cf
+
+#Run http server
+RealServer1=RealServer1
+RealServer1_ADDR=127.0.0.1
+RealServer1_PORT=50001
+start_lighttpd -s $RealServer1 -a $RealServer1_ADDR -p $RealServer1_PORT
+if [ $? -ne 0 ]
+then
+        echo "Test failed: start_lighttpd RealServer1"
+        exit 1
+fi
+
+RealServer2=RealServer2
+RealServer2_ADDR=127.0.0.1
+RealServer2_PORT=50002
+start_lighttpd -s $RealServer2 -a $RealServer2_ADDR -p $RealServer2_PORT
+if [ $? -ne 0 ]
+then
+        echo "Test failed: start_lighttpd RealServer2"
+        exit 1
+fi
+
+# Start l7vsd
+$L7VSD
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $L7VSD"
+        exit 1
+fi
+usleep 100000
+
+# Start l7directord
+$INIT_L7DIRECTORD start 
+if [ $? -ne 0 ]
+then
+        echo "Test failed: $INIT_L7DIRECTORD start"
+        exit 1
+fi
+sleep 3
+
+RET=`$L7VSADM -l -n`
+EXPECT="Layer-7 Virtual Server version 3.0.1
+Prot LocalAddress:Port ProtoMod Scheduler
+  -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
+TCP 127.0.0.1:50000 sessionless rr
+  -> 127.0.0.1:50001              Masq    1      0          0         
+  -> 127.0.0.1:50002              Masq    1      0          0         "
+if [ "${RET}" != "${EXPECT}" ]
+then
+        echo "Test failed: $L7VSADM -l -n"
+        exit 1
+fi
+
+echo "test" > ${TMP_DIR}/index.html
+set_lighttpd_content $RealServer1 ${TMP_DIR}/index.html
+set_lighttpd_content $RealServer2 ${TMP_DIR}/index.html
+
+sleep 10
+
+RET=`$L7VSADM -l -n`
+EXPECT="Layer-7 Virtual Server version 3.0.1
+Prot LocalAddress:Port ProtoMod Scheduler
+  -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
+TCP 127.0.0.1:50000 sessionless rr
+  -> 127.0.0.1:50001              Masq    0      0          0         
+  -> 127.0.0.1:50002              Masq    0      0          0         "
+if [ "${RET}" != "${EXPECT}" ]
+then
+        echo "Test failed: $L7VSADM -l -n"
+        exit 1
+fi
+
+echo "$RealServer1" > ${TMP_DIR}/index.html
+set_lighttpd_content $RealServer1 ${TMP_DIR}/index.html
+echo "$RealServer2" > ${TMP_DIR}/index.html
+set_lighttpd_content $RealServer2 ${TMP_DIR}/index.html
+
+sleep 10
+
+RET=`$L7VSADM -l -n`
+EXPECT="Layer-7 Virtual Server version 3.0.1
+Prot LocalAddress:Port ProtoMod Scheduler
+  -> RemoteAddress:Port           Forward Weight ActiveConn InactConn
+TCP 127.0.0.1:50000 sessionless rr
+  -> 127.0.0.1:50001              Masq    1      0          0         
+  -> 127.0.0.1:50002              Masq    1      0          0         "
+if [ "${RET}" != "${EXPECT}" ]
+then
+        echo "Test failed: $L7VSADM -l -n"
+        exit 1
+fi
+
+exit 0
+