Test fixes and debugging (#1005)

test_controlnet: log to stdout for now
test_walkthrough: wait for http server connection
This commit is contained in:
lantz
2021-01-09 18:53:50 -08:00
committed by GitHub
parent 77c473687e
commit 53975940de
2 changed files with 12 additions and 8 deletions
+5 -3
View File
@@ -7,13 +7,15 @@ Test for controlnet.py
import unittest
from mininet.util import pexpect
from sys import stdout
class testControlNet( unittest.TestCase ):
prompt = 'mininet>'
def testPingall( self ):
"Simple pingall test that verifies 0% packet drop in data network"
p = pexpect.spawn( 'python -m mininet.examples.controlnet' )
p = pexpect.spawn( 'python -m mininet.examples.controlnet', logfile=stdout)
p.expect( self.prompt )
p.sendline( 'pingall' )
p.expect ( '(\d+)% dropped' )
@@ -26,9 +28,9 @@ class testControlNet( unittest.TestCase ):
def testFailover( self ):
"Kill controllers and verify that switch, s1, fails over properly"
count = 1
p = pexpect.spawn( 'python -m mininet.examples.controlnet' )
p = pexpect.spawn( 'python -m mininet.examples.controlnet', logfile=stdout )
p.expect( self.prompt )
lp = pexpect.spawn( 'tail -f /tmp/s1-ofp.log' )
lp = pexpect.spawn( 'tail -f /tmp/s1-ofp.log', logfile=stdout )
lp.expect( 'tcp:\d+\.\d+\.\d+\.(\d+):\d+: connected' )
ip = int( lp.match.group( 1 ) )
self.assertEqual( count, ip )