Commit 9fedc763 authored by Jérome Perrin's avatar Jérome Perrin

seleniumserver/test: fix flaky test

This test was just checking the data from the first recv call, but the
data might arrive in multiple times. Call recv in a loop until we
received the end of the expected message (or until timeout when
something goes wrong).
parent c84c5c86
......@@ -381,11 +381,15 @@ class TestSSHServer(SeleniumServerTestCase):
channel = client.invoke_shell()
channel.settimeout(30)
# apparently we sometimes need to send something on the first ssh connection
channel.send('\n')
# openssh prints a warning 'Attempt to write login records by non-root user (aborting)'
# so we received more than the lenght of the asserted message.
self.assertIn("Welcome to SlapOS Selenium Server.", channel.recv(100))
received = ''
while True:
r = channel.recv(1024)
if not r:
break
received += r
if 'Selenium Server.' in received:
break
self.assertIn("Welcome to SlapOS Selenium Server.", received)
class TestFirefox52(BrowserCompatibilityMixin, SeleniumServerTestCase):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment