From 6ae9260e9e21d2b48c20ec43d9346548581047d4 Mon Sep 17 00:00:00 2001 From: Yu Liao Date: Tue, 4 Jan 2022 12:14:02 -0800 Subject: [PATCH] Fixed test flakiness, added loop to wait for non-empty response line. --- kubernetes/e2e_test/test_client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kubernetes/e2e_test/test_client.py b/kubernetes/e2e_test/test_client.py index 6700a05c2..2f3337ba9 100644 --- a/kubernetes/e2e_test/test_client.py +++ b/kubernetes/e2e_test/test_client.py @@ -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)