Fixed test flakiness, added loop to wait for non-empty response line.

This commit is contained in:
Yu Liao 2022-01-04 12:14:02 -08:00
parent 26e6940d20
commit 6ae9260e9e

View File

@ -144,7 +144,11 @@ class TestClient(unittest.TestCase):
self.assertEqual("test string 2", line)
resp.write_stdin("exit\n")
resp.update(timeout=5)
line = resp.read_channel(ERROR_CHANNEL)
while True:
line = resp.read_channel(ERROR_CHANNEL)
if line != '':
break
time.sleep(1)
status = json.loads(line)
self.assertEqual(status['status'], 'Success')
resp.update(timeout=5)