diff --git a/examples/test/test_baresshd.py b/examples/test/test_baresshd.py index 3d5df93..7888e74 100755 --- a/examples/test/test_baresshd.py +++ b/examples/test/test_baresshd.py @@ -5,8 +5,9 @@ Tests for baresshd.py """ import unittest -import pexpect +from mininet.util import pexpect from mininet.clean import cleanup, sh +from sys import stdout class testBareSSHD( unittest.TestCase ): @@ -14,7 +15,9 @@ class testBareSSHD( unittest.TestCase ): def connected( self ): "Log into ssh server, check banner, then exit" - p = pexpect.spawn( 'ssh 10.0.0.1 -o StrictHostKeyChecking=no -i /tmp/ssh/test_rsa exit' ) + p = pexpect.spawn( 'ssh 10.0.0.1 -o ConnectTimeout=1 ' + '-o StrictHostKeyChecking=no ' + '-i /tmp/ssh/test_rsa exit' ) while True: index = p.expect( self.opts ) if index == 0: @@ -22,6 +25,7 @@ class testBareSSHD( unittest.TestCase ): else: return False + def setUp( self ): # verify that sshd is not running self.assertFalse( self.connected() )