summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test/graceful_restart_test.py
diff options
context:
space:
mode:
authorCarl Baldwin <carl@ecbaldwin.net>2018-10-29 20:01:39 +0000
committerCarl Baldwin <carl@ecbaldwin.net>2018-10-29 20:10:19 +0000
commit8bccb4278a1c6cb291a9635a4b2252372f074b7e (patch)
treed1f9d1061a1db670fea7af527e10add4a2b09e59 /test/scenario_test/graceful_restart_test.py
parentc8694bc8a7dccd663689f8d134b89fe3a1f37d70 (diff)
Use assertEqual in python tests
In trying to run the local tests, I found that changing these assertTrue calls to assertEqual helped me out. With this, a failure shows the actual and expected values rather than just saying "True is not False" which is less helpful.
Diffstat (limited to 'test/scenario_test/graceful_restart_test.py')
-rw-r--r--test/scenario_test/graceful_restart_test.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/scenario_test/graceful_restart_test.py b/test/scenario_test/graceful_restart_test.py
index ab2eec1e..a97c9642 100644
--- a/test/scenario_test/graceful_restart_test.py
+++ b/test/scenario_test/graceful_restart_test.py
@@ -129,7 +129,7 @@ class GoBGPTestBase(unittest.TestCase):
g3.add_peer(g1)
g1.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=g3)
time.sleep(1)
- self.assertTrue(len(g3.get_global_rib('10.10.20.0/24')) == 1)
+ self.assertEqual(len(g3.get_global_rib('10.10.20.0/24')), 1)
def test_05_graceful_restart(self):
g1 = self.bgpds['g1']
@@ -137,19 +137,19 @@ class GoBGPTestBase(unittest.TestCase):
g3 = self.bgpds['g3']
g1.stop_gobgp()
g2.wait_for(expected_state=BGP_FSM_ACTIVE, peer=g1)
- self.assertTrue(len(g2.get_global_rib('10.10.20.0/24')) == 1)
- self.assertTrue(len(g2.get_global_rib('10.10.30.0/24')) == 1)
+ self.assertEqual(len(g2.get_global_rib('10.10.20.0/24')), 1)
+ self.assertEqual(len(g2.get_global_rib('10.10.30.0/24')), 1)
for d in g2.get_global_rib():
for p in d['paths']:
self.assertTrue(p['stale'])
- self.assertTrue(len(g3.get_global_rib('10.10.20.0/24')) == 0)
- self.assertTrue(len(g3.get_global_rib('10.10.30.0/24')) == 1)
+ self.assertEqual(len(g3.get_global_rib('10.10.20.0/24')), 0)
+ self.assertEqual(len(g3.get_global_rib('10.10.30.0/24')), 1)
def test_06_test_restart_timer_expire(self):
time.sleep(GRACEFUL_RESTART_TIME + 5)
g2 = self.bgpds['g2']
- self.assertTrue(len(g2.get_global_rib()) == 0)
+ self.assertEqual(len(g2.get_global_rib()), 0)
def test_07_multineighbor_established(self):
g1 = self.bgpds['g1']