mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Copilot
11 hours ago 28982064c9f141c4ccee13674018792908912e11
Fix flaky `testMultiRS`: replace fixed sleep with deterministic domain-ready wait (#615)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
1 files modified
20 ■■■■■ changed files
opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java 20 ●●●●● patch | view | raw | blame | history
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()