summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.travis.yml24
-rw-r--r--test/lib/quagga.py6
-rw-r--r--test/scenario_test/bgp_router_test.py3
-rw-r--r--test/scenario_test/ci-scripts/travis-build-script.sh150
-rw-r--r--test/scenario_test/ibgp_router_test.py2
-rw-r--r--test/scenario_test/route_reflector_test.py3
-rw-r--r--test/scenario_test/route_server_as2_test.py3
-rw-r--r--test/scenario_test/route_server_ipv4_v6_test.py3
-rw-r--r--test/scenario_test/route_server_test.py5
9 files changed, 194 insertions, 5 deletions
diff --git a/.travis.yml b/.travis.yml
index dcb871d5..89783aa7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,13 +1,31 @@
language: go
-go:
+sudo: required
+services:
+ - docker
+
+go:
- 1.3
- 1.4
- 1.5
- 1.6
- tip
+env:
+ - SCENARIO=false
+ - SCENARIO=true
+
+matrix:
+ exclude:
+ - go: 1.3
+ env: SCENARIO=true
+ - go: 1.4
+ env: SCENARIO=true
+ - go: 1.5
+ env: SCENARIO=true
+ - go: tip
+ env: SCENARIO=true
+
script:
- - go test -v ./...
+ - bash test/scenario_test/ci-scripts/travis-build-script.sh $SCENARIO
-sudo: false
diff --git a/test/lib/quagga.py b/test/lib/quagga.py
index e76c7a8b..924a3a82 100644
--- a/test/lib/quagga.py
+++ b/test/lib/quagga.py
@@ -262,5 +262,9 @@ class QuaggaBGPContainer(BGPContainer):
daemon.append('zebra')
for d in daemon:
cmd = '/usr/bin/pkill {0} -SIGHUP'.format(d)
- self.local(cmd)
+ m = self.local(cmd, capture=True)
+ return_code = getattr(m, 'return_code')
+ if return_code != 0:
+ errmsg = "ret_code:%s, stdout:%s, stderr:%s" % (return_code, getattr(m, 'stdout'), getattr(m, 'stderr'))
+ raise Exception('reload_config error. errmsg: %s' % errmsg)
diff --git a/test/scenario_test/bgp_router_test.py b/test/scenario_test/bgp_router_test.py
index 3bac02ff..dd7c1edb 100644
--- a/test/scenario_test/bgp_router_test.py
+++ b/test/scenario_test/bgp_router_test.py
@@ -74,8 +74,11 @@ class GoBGPTestBase(unittest.TestCase):
timeout = 120
interval = 1
count = 0
+
while True:
# gobgp's global rib
+ state = self.gobgp.get_neighbor_state(q)
+ self.assertEqual(state, BGP_FSM_ESTABLISHED)
global_rib = [p['prefix'] for p in self.gobgp.get_global_rib()]
for p in global_rib:
diff --git a/test/scenario_test/ci-scripts/travis-build-script.sh b/test/scenario_test/ci-scripts/travis-build-script.sh
new file mode 100644
index 00000000..afc5c89b
--- /dev/null
+++ b/test/scenario_test/ci-scripts/travis-build-script.sh
@@ -0,0 +1,150 @@
+
+SCENARIO=$1
+echo "travis-build-script.sh"
+
+if [ "$SCENARIO" != "true" ]; then
+ echo "execute unit test."
+ go version
+ go test -v ./...
+ exit $?
+fi
+
+echo "Docker version"
+docker version
+echo ""
+
+export GOBGP_IMAGE=gobgp
+export GOBGP=`pwd`
+
+sudo apt-get -q update
+sudo apt-get -q -y install iputils-arping bridge-utils lv
+sudo wget https://raw.github.com/jpetazzo/pipework/master/pipework -O /usr/local/bin/pipework
+sudo chmod 755 /usr/local/bin/pipework
+
+sudo -H pip --quiet install nose toml ciscoconfparse ecdsa "pycrypto>=2.1" fabric netaddr nsenter
+
+ls -al
+git log | head -20
+
+sudo fab -f $GOBGP/test/lib/base.py make_gobgp_ctn:tag=$GOBGP_IMAGE
+[ "$?" != 0 ] && exit "$?"
+
+cd $GOBGP/test/scenario_test
+
+PIDS=()
+
+sudo PYTHONPATH=$GOBGP/test python route_server_test.py --gobgp-image $GOBGP_IMAGE --test-prefix rs -x &
+PIDS=("${PIDS[@]}" $!)
+
+sudo PYTHONPATH=$GOBGP/test python route_server_ipv4_v6_test.py --gobgp-image $GOBGP_IMAGE --test-prefix v6 -x &
+PIDS=("${PIDS[@]}" $!)
+
+sudo PYTHONPATH=$GOBGP/test python bgp_router_test.py --gobgp-image $GOBGP_IMAGE --test-prefix bgp -x &
+PIDS=("${PIDS[@]}" $!)
+
+sudo PYTHONPATH=$GOBGP/test python ibgp_router_test.py --gobgp-image $GOBGP_IMAGE --test-prefix ibgp -x &
+PIDS=("${PIDS[@]}" $!)
+
+sudo PYTHONPATH=$GOBGP/test python evpn_test.py --gobgp-image $GOBGP_IMAGE --test-prefix evpn -x &
+PIDS=("${PIDS[@]}" $!)
+
+sudo PYTHONPATH=$GOBGP/test python flow_spec_test.py --gobgp-image $GOBGP_IMAGE --test-prefix flow -x &
+PIDS=("${PIDS[@]}" $!)
+
+sudo PYTHONPATH=$GOBGP/test python route_reflector_test.py --gobgp-image $GOBGP_IMAGE --test-prefix rr -x &
+PIDS=("${PIDS[@]}" $!)
+
+sudo PYTHONPATH=$GOBGP/test python global_policy_test.py --gobgp-image $GOBGP_IMAGE --test-prefix gpol -x &
+PIDS=("${PIDS[@]}" $!)
+
+sudo PYTHONPATH=$GOBGP/test python route_server_as2_test.py --gobgp-image $GOBGP_IMAGE --test-prefix as2 -x &
+PIDS=("${PIDS[@]}" $!)
+
+sudo PYTHONPATH=$GOBGP/test python graceful_restart_test.py --gobgp-image $GOBGP_IMAGE --test-prefix gr -x &
+PIDS=("${PIDS[@]}" $!)
+
+sudo PYTHONPATH=$GOBGP/test python bgp_zebra_test.py --gobgp-image $GOBGP_IMAGE --test-prefix zebra -x &
+PIDS=("${PIDS[@]}" $!)
+
+for (( i = 0; i < ${#PIDS[@]}; ++i ))
+do
+ wait ${PIDS[$i]}
+ if [ $? != 0 ]; then
+ exit 1
+ fi
+done
+
+PIDS=()
+
+# route server malformed message test
+NUM=$(sudo PYTHONPATH=$GOBGP/test python route_server_malformed_test.py --test-index -1 -s 2> /dev/null | awk '/invalid/{print $NF}')
+PARALLEL_NUM=10
+for (( i = 1; i < $(( $NUM + 1)); ++i ))
+do
+ sudo PYTHONPATH=$GOBGP/test python route_server_malformed_test.py --gobgp-image $GOBGP_IMAGE --test-prefix mal$i --test-index $i -x --gobgp-log-level debug &
+ PIDS=("${PIDS[@]}" $!)
+ sleep 3
+done
+
+for (( i = 0; i < ${#PIDS[@]}; ++i ))
+do
+ wait ${PIDS[$i]}
+ if [ $? != 0 ]; then
+ exit 1
+ fi
+done
+
+# route server policy test
+NUM=$(sudo PYTHONPATH=$GOBGP/test python route_server_policy_test.py --test-index -1 -s 2> /dev/null | awk '/invalid/{print $NF}')
+PARALLEL_NUM=10
+for (( i = 0; i < $(( NUM / PARALLEL_NUM + 1)); ++i ))
+do
+ PIDS=()
+ for (( j = $((PARALLEL_NUM * $i + 1)); j < $((PARALLEL_NUM * ($i+1) + 1)); ++j))
+ do
+ sudo PYTHONPATH=$GOBGP/test python route_server_policy_test.py --gobgp-image $GOBGP_IMAGE --test-prefix p$j --test-index $j -x --gobgp-log-level debug &
+ PIDS=("${PIDS[@]}" $!)
+ if [ $j -eq $NUM ]; then
+ break
+ fi
+ sleep 3
+ done
+
+ for (( j = 0; j < ${#PIDS[@]}; ++j ))
+ do
+ wait ${PIDS[$j]}
+ if [ $? != 0 ]; then
+ exit 1
+ fi
+ done
+
+done
+
+# route server policy grpc test
+NUM=$(sudo PYTHONPATH=$GOBGP/test python route_server_policy_grpc_test.py --test-index -1 -s 2> /dev/null | awk '/invalid/{print $NF}')
+PARALLEL_NUM=10
+for (( i = 0; i < $(( NUM / PARALLEL_NUM + 1)); ++i ))
+do
+ PIDS=()
+ for (( j = $((PARALLEL_NUM * $i + 1)); j < $((PARALLEL_NUM * ($i+1) + 1)); ++j))
+ do
+ sudo PYTHONPATH=$GOBGP/test python route_server_policy_grpc_test.py --gobgp-image $GOBGP_IMAGE --test-prefix pg$j --test-index $j -x --gobgp-log-level debug &
+ PIDS=("${PIDS[@]}" $!)
+ if [ $j -eq $NUM ]; then
+ break
+ fi
+ sleep 3
+ done
+
+ for (( j = 0; j < ${#PIDS[@]}; ++j ))
+ do
+ wait ${PIDS[$j]}
+ if [ $? != 0 ]; then
+ exit 1
+ fi
+ done
+
+done
+
+echo 'all tests passed successfully'
+exit 0
diff --git a/test/scenario_test/ibgp_router_test.py b/test/scenario_test/ibgp_router_test.py
index 5e40bf13..2dc68072 100644
--- a/test/scenario_test/ibgp_router_test.py
+++ b/test/scenario_test/ibgp_router_test.py
@@ -73,6 +73,8 @@ class GoBGPTestBase(unittest.TestCase):
count = 0
while True:
# gobgp's global rib
+ state = self.gobgp.get_neighbor_state(q)
+ self.assertEqual(state, BGP_FSM_ESTABLISHED)
global_rib = [p['prefix'] for p in self.gobgp.get_global_rib()]
for p in global_rib:
diff --git a/test/scenario_test/route_reflector_test.py b/test/scenario_test/route_reflector_test.py
index 73e7f4d9..775032cf 100644
--- a/test/scenario_test/route_reflector_test.py
+++ b/test/scenario_test/route_reflector_test.py
@@ -87,6 +87,9 @@ class GoBGPTestBase(unittest.TestCase):
for q in self.quaggas.itervalues():
# paths expected to exist in gobgp's global rib
def f():
+ state = self.gobgp.get_neighbor_state(q)
+ self.assertEqual(state, BGP_FSM_ESTABLISHED)
+
routes = q.routes.keys()
global_rib = [p['prefix'] for p in self.gobgp.get_global_rib()]
for p in global_rib:
diff --git a/test/scenario_test/route_server_as2_test.py b/test/scenario_test/route_server_as2_test.py
index 4049d634..8978a084 100644
--- a/test/scenario_test/route_server_as2_test.py
+++ b/test/scenario_test/route_server_as2_test.py
@@ -82,6 +82,9 @@ class GoBGPTestBase(unittest.TestCase):
for _ in range(self.retry_limit):
if done:
break
+
+ state = self.gobgp.get_neighbor_state(rs_client)
+ self.assertEqual(state, BGP_FSM_ESTABLISHED)
local_rib = self.gobgp.get_local_rib(rs_client)
local_rib = [p['prefix'] for p in local_rib]
if len(local_rib) < len(self.quaggas)-1:
diff --git a/test/scenario_test/route_server_ipv4_v6_test.py b/test/scenario_test/route_server_ipv4_v6_test.py
index 45b85204..c32bfecf 100644
--- a/test/scenario_test/route_server_ipv4_v6_test.py
+++ b/test/scenario_test/route_server_ipv4_v6_test.py
@@ -82,6 +82,9 @@ class GoBGPIPv6Test(unittest.TestCase):
for _ in range(self.retry_limit):
if done:
break
+
+ state = self.gobgp.get_neighbor_state(rs_client)
+ self.assertEqual(state, BGP_FSM_ESTABLISHED)
local_rib = self.gobgp.get_local_rib(rs_client, rf=rf)
local_rib = [p['prefix'] for p in local_rib]
if len(local_rib) < len(ctns)-1:
diff --git a/test/scenario_test/route_server_test.py b/test/scenario_test/route_server_test.py
index a470716a..ab305e44 100644
--- a/test/scenario_test/route_server_test.py
+++ b/test/scenario_test/route_server_test.py
@@ -28,7 +28,7 @@ from noseplugin import OptionParser, parser_option
class GoBGPTestBase(unittest.TestCase):
wait_per_retry = 5
- retry_limit = 10
+ retry_limit = 15
@classmethod
def setUpClass(cls):
@@ -73,6 +73,9 @@ class GoBGPTestBase(unittest.TestCase):
break
local_rib = self.gobgp.get_local_rib(rs_client)
local_rib = [p['prefix'] for p in local_rib]
+
+ state = self.gobgp.get_neighbor_state(rs_client)
+ self.assertEqual(state, BGP_FSM_ESTABLISHED)
if len(local_rib) < len(self.quaggas)-1:
time.sleep(self.wait_per_retry)
continue