From 7367aa439db9731c364a256444f0afa1c61973a4 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Thu, 05 Nov 2026 12:52:28 +0000
Subject: [PATCH] [#1273] Fix expected CSN list race in HistoricalCsnOrderingTest (#1274)

---
 opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java
index a89fe96..1fd3ba0 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java
@@ -1827,6 +1827,7 @@
     LDAPReplicationDomain rd1 = createReplicationDomain(serverId);
     final CountDownLatch held = new CountDownLatch(1);
     final CountDownLatch release = new CountDownLatch(1);
+    final CountDownLatch changeDone = new CountDownLatch(1);
     try
     {
       second = createIsolatedReplicationServer(secondPort, "HistoricalCsnOrderingSecond", SECOND_RS_ID);
@@ -1859,11 +1860,15 @@
           {
             replace(dnA, "displayName", "once the publisher ran on the session before");
             done.add(rd1.getLastLocalChange());
+            changeDone.countDown();
           }).run();
         }
       });
       release.countDown();
 
+      // Wait for both expected CSNs before reading the list the publisher updates.
+      assertTrue(changeDone.await(30, SECONDS), "the publisher recorded the second change");
+      final List<CSN> expected = new ArrayList<>(done);
       final ReplicationServer secondRs = second;
       new TestTimer.Builder()
           .maxSleep(30, SECONDS)
@@ -1871,7 +1876,7 @@
           .toTimer()
           .repeatUntilSuccess(() -> assertThat(changelogAfter(secondRs, baseDN, onBoth))
               .as("the changes the second replication server holds after the one it had")
-              .isEqualTo(done));
+              .isEqualTo(expected));
       waitUntilTheRecoveryIsOver(rd1);
     }
     finally

--
Gitblit v1.10.0