From 82998cac8b561097ec8455408aa767e3382e7cd4 Mon Sep 17 00:00:00 2001 From: Bob Lantz Date: Tue, 10 Jul 2018 07:36:55 -0700 Subject: [PATCH] waitConnected and debug output for testMultiPing This test fails periodically on Travis (#714) Hopefully waiting for connection will make it more reliable, and if not then the debug output will help. --- examples/multiping.py | 2 +- examples/test/test_multiping.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/multiping.py b/examples/multiping.py index 3dd730d..fedf462 100755 --- a/examples/multiping.py +++ b/examples/multiping.py @@ -45,7 +45,7 @@ def multiping( netsize, chunksize, seconds): # Create network and identify subnets topo = SingleSwitchTopo( netsize ) - net = Mininet( topo=topo ) + net = Mininet( topo=topo, waitConnected=True ) net.start() hosts = net.hosts subnets = chunks( hosts, chunksize ) diff --git a/examples/test/test_multiping.py b/examples/test/test_multiping.py index 4649b3b..bb5440a 100755 --- a/examples/test/test_multiping.py +++ b/examples/test/test_multiping.py @@ -31,18 +31,20 @@ class testMultiPing( unittest.TestCase ): target = p.match.group(3) received = int( p.match.group(4) ) if target == '10.0.0.200': - self.assertEqual( received, 0 ) + self.assertEqual( received, 0, p.match.group(0) + '\n' + + target + ' received %d != 0 packets' % received ) else: - self.assertEqual( received, 1 ) + self.assertEqual( received, 1, p.match.group(0) + '\n' + + target + ' received %d != 1 packets' % received ) try: pings[ name ].remove( target ) except: pass else: break - self.assertTrue( len( pings ) > 0 ) + self.assertTrue( len( pings ) > 0, 'too few pings' ) for t in pings.values(): - self.assertEqual( len( t ), 0 ) + self.assertEqual( len( t ), 0, 'missed ping target(s): %s' % t ) if __name__ == '__main__': unittest.main()