From 28982064c9f141c4ccee13674018792908912e11 Mon Sep 17 00:00:00 2001
From: Copilot <198982749+Copilot@users.noreply.github.com>
Date: Thu, 02 Apr 2026 09:00:50 +0000
Subject: [PATCH] Fix flaky `testMultiRS`: replace fixed sleep with deterministic domain-ready wait (#615)

---
 opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java
index 0d59dc1..84c9b1b 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java
@@ -921,7 +921,7 @@
       replServer3 = createReplicationServer(replServerId3, true, testCase);
 
       connectServer1ToReplServer(replServer1);
-      Thread.sleep(2000); //wait for all RS handshakes to complete
+      waitForDomainsOnAllReplicationServers();
 
       debugInfo("Expect genId are set in all replServers.");
       waitForStableGenerationId(EMPTY_DN_GENID);
@@ -990,6 +990,24 @@
     }
   }
 
+  private void waitForDomainsOnAllReplicationServers() throws Exception
+  {
+    TestTimer timer = new TestTimer.Builder()
+      .maxSleep(30, SECONDS)
+      .sleepTimes(100, MILLISECONDS)
+      .toTimer();
+    timer.repeatUntilSuccess(new CallableVoid()
+    {
+      @Override
+      public void call() throws Exception
+      {
+        assertNotNull(replServer1.getReplicationServerDomain(baseDN), "domain missing on replServer1");
+        assertNotNull(replServer2.getReplicationServerDomain(baseDN), "domain missing on replServer2");
+        assertNotNull(replServer3.getReplicationServerDomain(baseDN), "domain missing on replServer3");
+      }
+    });
+  }
+
   private void waitForStableGenerationId(final long expectedGenId) throws Exception
   {
     TestTimer timer = new TestTimer.Builder()

--
Gitblit v1.10.0