Commit 6ab16083 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 bb8d9476
...@@ -381,11 +381,15 @@ class TestSSHServer(SeleniumServerTestCase): ...@@ -381,11 +381,15 @@ class TestSSHServer(SeleniumServerTestCase):
channel = client.invoke_shell() channel = client.invoke_shell()
channel.settimeout(30) channel.settimeout(30)
# apparently we sometimes need to send something on the first ssh connection received = ''
channel.send('\n') while True:
# openssh prints a warning 'Attempt to write login records by non-root user (aborting)' r = channel.recv(1024)
# so we received more than the lenght of the asserted message. if not r:
self.assertIn("Welcome to SlapOS Selenium Server.", channel.recv(100)) break
received += r
if 'Selenium Server.' in received:
break
self.assertIn("Welcome to SlapOS Selenium Server.", received)
class TestFirefox52(BrowserCompatibilityMixin, SeleniumServerTestCase): 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