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.
This commit is contained in:
Bob Lantz
2018-07-10 07:41:19 -07:00
parent 34b1f4161a
commit 82998cac8b
2 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ def multiping( netsize, chunksize, seconds):
# Create network and identify subnets # Create network and identify subnets
topo = SingleSwitchTopo( netsize ) topo = SingleSwitchTopo( netsize )
net = Mininet( topo=topo ) net = Mininet( topo=topo, waitConnected=True )
net.start() net.start()
hosts = net.hosts hosts = net.hosts
subnets = chunks( hosts, chunksize ) subnets = chunks( hosts, chunksize )
+6 -4
View File
@@ -31,18 +31,20 @@ class testMultiPing( unittest.TestCase ):
target = p.match.group(3) target = p.match.group(3)
received = int( p.match.group(4) ) received = int( p.match.group(4) )
if target == '10.0.0.200': 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: else:
self.assertEqual( received, 1 ) self.assertEqual( received, 1, p.match.group(0) + '\n' +
target + ' received %d != 1 packets' % received )
try: try:
pings[ name ].remove( target ) pings[ name ].remove( target )
except: except:
pass pass
else: else:
break break
self.assertTrue( len( pings ) > 0 ) self.assertTrue( len( pings ) > 0, 'too few pings' )
for t in pings.values(): for t in pings.values():
self.assertEqual( len( t ), 0 ) self.assertEqual( len( t ), 0, 'missed ping target(s): %s' % t )
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()