summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-08-18 17:41:28 +0900
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-08-18 19:09:10 +0900
commit7ba78e831c23352179e846e096a2a3ecbd3f8f37 (patch)
tree5ccbc01ad3000a2b7f84984becf2f47ecc44a3a9 /test/scenario_test
parent94ba9c23ee5b5977410612287ade31cd7b235ac1 (diff)
test: add a script for local scenario testing
NOTE: This script doesn't make a gobgp docker image for testing. Type the command below to make/update the image. $ fab -f ./lib/base.py make_gobgp_ctn --set tag=gobgp Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'test/scenario_test')
-rw-r--r--test/scenario_test/ci-scripts/jenkins-build-script.sh55
-rwxr-xr-xtest/scenario_test/run_all_tests.sh81
2 files changed, 84 insertions, 52 deletions
diff --git a/test/scenario_test/ci-scripts/jenkins-build-script.sh b/test/scenario_test/ci-scripts/jenkins-build-script.sh
index e4f8d3e2..953c3d09 100644
--- a/test/scenario_test/ci-scripts/jenkins-build-script.sh
+++ b/test/scenario_test/ci-scripts/jenkins-build-script.sh
@@ -7,8 +7,8 @@ export GOBGP_IMAGE=gobgp
export GOPATH=/usr/local/jenkins
export GOROOT=/usr/local/go
export GOBGP=/usr/local/jenkins/src/github.com/osrg/gobgp
+export WS=`pwd`
-WS=`pwd`
cp -r ../workspace $GOBGP
pwd
cd $GOBGP
@@ -22,56 +22,7 @@ sudo fab -f $GOBGP/test/scenario_test/lib/base.py make_gobgp_ctn --set tag=$GOBG
cd $GOBGP/gobgpd
$GOROOT/bin/go get -v
-cd $GOBGP/test/scenario_test
-set +e
-
-sudo -E pip install -r pip-requires.txt
-
-# route server test
-sudo -E python route_server_test.py --gobgp-image $GOBGP_IMAGE --test-prefix rs -s --with-xunit --xunit-file=${WS}/nosetest.xml
-RET1=$?
-
-# route server ipv4 ipv6 test
-sudo -E python route_server_ipv4_v6_test.py --gobgp-image $GOBGP_IMAGE --test-prefix v6 -s --with-xunit --xunit-file=${WS}/nosetest_ip.xml
-RET2=$?
-
-# route server malformed message test
-sudo -E python route_server_malformed_test.py --gobgp-image $GOBGP_IMAGE --go-path $GOROOT/bin -s --with-xunit --xunit-file=${WS}/nosetest_malformed.xml
-RET3=$?
-
-# route server policy test
-sudo -E python route_server_policy_test.py --gobgp-image $GOBGP_IMAGE --go-path $GOROOT/bin -s --with-xunit --xunit-file=${WS}/nosetest_policy.xml
-RET4=$?
-
-if [ $RET1 != 0 ] || [ $RET2 != 0 ] || [ $RET3 != 0 ] || [ $RET4 != 0 ]; then
- exit 1
-fi
-PIDS=()
-
-# bgp router test
-sudo -E python bgp_router_test.py --gobgp-image $GOBGP_IMAGE --test-prefix bgp -s -x --with-xunit --xunit-file=${WS}/nosetest_bgp.xml &
-PIDS=("${PIDS[@]}" $!)
-
-# ibgp router test
-sudo -E python ibgp_router_test.py --gobgp-image $GOBGP_IMAGE --test-prefix ibgp -s -x --with-xunit --xunit-file=${WS}/nosetest_ibgp.xml &
-PIDS=("${PIDS[@]}" $!)
-
-# evpn test
-sudo -E python evpn_test.py --gobgp-image $GOBGP_IMAGE --test-prefix evpn -s -x --with-xunit --xunit-file=${WS}/nosetest_evpn.xml&
-PIDS=("${PIDS[@]}" $!)
-
-# flowspec test
-sudo -E python flow_spec_test.py --gobgp-image $GOBGP_IMAGE --test-prefix flow -s -x --with-xunit --xunit-file=${WS}/nosetest_flow.xml&
-PIDS=("${PIDS[@]}" $!)
-
-for (( i = 0; i < ${#PIDS[@]}; ++i ))
-do
- wait ${PIDS[$i]}
- if [ $? != 0 ]; then
- exit 1
- fi
-done
+cd $GOBGP/test/scenario_test
-echo 'all tests passed successfully'
-exit 0
+./run_all_tests.sh
diff --git a/test/scenario_test/run_all_tests.sh b/test/scenario_test/run_all_tests.sh
new file mode 100755
index 00000000..42d81eaa
--- /dev/null
+++ b/test/scenario_test/run_all_tests.sh
@@ -0,0 +1,81 @@
+#!/bin/bash
+set +e
+
+if [ ! -v GOROOT ]; then
+ if which go > /dev/null; then
+ GOROOT=`dirname $(dirname $(which go))`
+ else
+ echo 'set $GOROOT'
+ exit 1
+ fi
+fi
+
+if [ ! -v GOPATH ]; then
+ echo 'set $GOPATH'
+ exit 1
+fi
+
+if [ ! -v GOBGP ]; then
+ GOBGP=$GOPATH/src/github.com/osrg/gobgp
+fi
+
+if [ ! -v GOBGP_IMAGE ]; then
+ GOBGP_IMAGE=gobgp
+fi
+
+if [ ! -v WS ]; then
+ WS=`pwd`
+fi
+
+cd $GOBGP/test/scenario_test
+
+PIDS=()
+
+# route server malformed message test
+sudo -E python route_server_malformed_test.py --gobgp-image $GOBGP_IMAGE --go-path $GOROOT/bin -s --with-xunit --xunit-file=${WS}/nosetest_malformed.xml
+RET1=$?
+if [ $RET1 != 0 ]; then
+ exit 1
+fi
+
+# route server policy test
+sudo -E python route_server_policy_test.py --gobgp-image $GOBGP_IMAGE --go-path $GOROOT/bin -s --with-xunit --xunit-file=${WS}/nosetest_policy.xml
+RET2=$?
+if [ $RET2 != 0 ]; then
+ exit 1
+fi
+
+# route server test
+sudo -E python route_server_test.py --gobgp-image $GOBGP_IMAGE --test-prefix rs -s -x --with-xunit --xunit-file=${WS}/nosetest.xml &
+PIDS=("${PIDS[@]}" $!)
+
+# route server ipv4 ipv6 test
+sudo -E python route_server_ipv4_v6_test.py --gobgp-image $GOBGP_IMAGE --test-prefix v6 -s -x --with-xunit --xunit-file=${WS}/nosetest_ip.xml &
+PIDS=("${PIDS[@]}" $!)
+
+# bgp router test
+sudo -E python bgp_router_test.py --gobgp-image $GOBGP_IMAGE --test-prefix bgp -s -x --with-xunit --xunit-file=${WS}/nosetest_bgp.xml &
+PIDS=("${PIDS[@]}" $!)
+
+# ibgp router test
+sudo -E python ibgp_router_test.py --gobgp-image $GOBGP_IMAGE --test-prefix ibgp -s -x --with-xunit --xunit-file=${WS}/nosetest_ibgp.xml &
+PIDS=("${PIDS[@]}" $!)
+
+# evpn router test
+sudo -E python evpn_test.py --gobgp-image $GOBGP_IMAGE --test-prefix evpn -s -x --with-xunit --xunit-file=${WS}/nosetest_evpn.xml &
+PIDS=("${PIDS[@]}" $!)
+
+# flowspec test
+sudo -E python flow_spec_test.py --gobgp-image $GOBGP_IMAGE --test-prefix flow -s -x --with-xunit --xunit-file=${WS}/nosetest_flow.xml &
+PIDS=("${PIDS[@]}" $!)
+
+for (( i = 0; i < ${#PIDS[@]}; ++i ))
+do
+ wait ${PIDS[$i]}
+ if [ $? != 0 ]; then
+ exit 1
+ fi
+done
+
+echo 'all tests passed successfully'
+exit 0