From 2678147b005bfcf334252524cd5e75a27900a05a Mon Sep 17 00:00:00 2001 From: Shrinand Thakkar Date: Tue, 15 Aug 2023 10:38:49 -0700 Subject: [PATCH] Fixing Flaky Test testLeaderDoAssignmentForNewlyElectedLeaderFailurePathVariation (#953) Co-authored-by: Shrinand Thakkar --- .../java/com/linkedin/datastream/server/TestCoordinator.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/datastream-server-restli/src/test/java/com/linkedin/datastream/server/TestCoordinator.java b/datastream-server-restli/src/test/java/com/linkedin/datastream/server/TestCoordinator.java index e8b2445d8..84283fb6d 100644 --- a/datastream-server-restli/src/test/java/com/linkedin/datastream/server/TestCoordinator.java +++ b/datastream-server-restli/src/test/java/com/linkedin/datastream/server/TestCoordinator.java @@ -4062,6 +4062,8 @@ protected synchronized void handleEvent(CoordinatorEvent event) { Datastream testDatastream = DatastreamTestUtils.createAndStoreDatastreams(zkClient, testCluster, connectorType, streamName)[0]; + // Blocking until we have performed atleast 5 retries of LeaderDoAssignmentEvent with a newly elected leader. + PollUtils.poll(() -> shadowListWithPreviousAndNewHeadPairsAtNewLeaderDoAssignmentEvent.size() > 5, 50, 2000); coordinator.stop(); zkClient.close(); coordinator.getDatastreamCache().getZkclient().close();