From 7e30983601b78cb436c9070868fff6aeb69a040f Mon Sep 17 00:00:00 2001 From: mdumandag Date: Tue, 15 Jun 2021 17:17:36 +0300 Subject: [PATCH] Fix `test_lifecycle_listener_receives_disconnected_event` This test failed in Github Actions runners. The reason of the failure is that, we try to check the received events right after shutting down the member. It might be the case that, the member is shutdown, but it is not visible to the client yet. To tackle that, we now use `assertTrueEventually` to verify that we receive the event. --- tests/integration/backward_compatible/lifecycle_test.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/integration/backward_compatible/lifecycle_test.py b/tests/integration/backward_compatible/lifecycle_test.py index 3eef40facd..1c63d9ca1a 100644 --- a/tests/integration/backward_compatible/lifecycle_test.py +++ b/tests/integration/backward_compatible/lifecycle_test.py @@ -67,7 +67,12 @@ def test_lifecycle_listener_receives_disconnected_event(self): ) client.lifecycle_service.add_listener(collector) member.shutdown() - self.assertEqual(collector.events, [LifecycleState.DISCONNECTED]) + + def assertion(): + self.assertEqual(collector.events, [LifecycleState.DISCONNECTED]) + + self.assertTrueEventually(assertion) + client.shutdown() def test_remove_lifecycle_listener(self):