Add small wait before wget in web test.
Although the walkthrough doesn't specify waiting, it is a race condition that we occasionally hit in tests. Adding a 2 second delay seems realistic (for when a human is doing the walkthrough) and should reduce the likelihood of hitting the race condition.
This commit is contained in:
@@ -12,6 +12,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
from mininet.util import quietRun
|
from mininet.util import quietRun
|
||||||
from distutils.version import StrictVersion
|
from distutils.version import StrictVersion
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
def tsharkVersion():
|
def tsharkVersion():
|
||||||
"Return tshark version"
|
"Return tshark version"
|
||||||
@@ -157,6 +158,11 @@ class testWalkthrough( unittest.TestCase ):
|
|||||||
p = pexpect.spawn( 'mn' )
|
p = pexpect.spawn( 'mn' )
|
||||||
p.expect( self.prompt )
|
p.expect( self.prompt )
|
||||||
p.sendline( 'h1 python -m SimpleHTTPServer 80 &' )
|
p.sendline( 'h1 python -m SimpleHTTPServer 80 &' )
|
||||||
|
# The walkthrough doesn't specify a delay here, and
|
||||||
|
# we also don't read the output (also a possible problem),
|
||||||
|
# but for now let's wait a couple of seconds to make
|
||||||
|
# it less likely to fail due to the race condition.
|
||||||
|
sleep( 2 )
|
||||||
p.expect( self.prompt )
|
p.expect( self.prompt )
|
||||||
p.sendline( ' h2 wget -O - h1' )
|
p.sendline( ' h2 wget -O - h1' )
|
||||||
p.expect( '200 OK' )
|
p.expect( '200 OK' )
|
||||||
|
|||||||
Reference in New Issue
Block a user