From f872566aafe7dd516fd50b5cb8ce6b3002746e71 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Wed, 08 Jul 2026 16:12:28 +0000
Subject: [PATCH] Fix and enable broken tests from the slow group (#686)

---
 opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java |   36 +++++++++++++++++++++++++++++++-----
 1 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java
index 34900cc..d973d2d 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java
@@ -13,6 +13,7 @@
  *
  * Copyright 2006-2010 Sun Microsystems, Inc.
  * Portions Copyright 2011-2016 ForgeRock AS.
+ * Portions Copyright 2023-2026 3A Systems, LLC
  */
 package org.opends.server.replication;
 
@@ -357,7 +358,7 @@
    * Tests whether the synchronization provider fails over when it loses
    * the heartbeat from the replication server.
    */
-  @Test(groups = "slow")
+  @Test
   public void lostHeartbeatFailover() throws Exception
   {
     testSetUp("lostHeartbeatFailover");
@@ -428,7 +429,7 @@
    * It then uses this session to simulate conflicts and therefore
    * test the modify conflict resolution code.
    */
-  @Test(enabled=true, groups="slow")
+  @Test(enabled=true)
   public void modifyConflicts() throws Exception
   {
     testSetUp("modifyConflicts");
@@ -532,7 +533,7 @@
       attrs = entry.getAllAttributes(attrType);
 
       // there should not be a value (delete at time t2)
-      assertNull(attrs);
+      Assertions.assertThat(attrs).isEmpty();
       assertEquals(getMonitorDelta(), 1);
     }
     finally
@@ -542,6 +543,28 @@
   }
 
   /**
+   * Waits for the replay thread to update the monitored counter: reading the
+   * monitor immediately after publishing a message races with the replay.
+   */
+  private void waitForMonitorDelta(final long expectedDelta) throws Exception
+  {
+    final long[] total = { 0 };
+    TestTimer timer = new TestTimer.Builder()
+      .maxSleep(30, SECONDS)
+      .sleepTimes(100, MILLISECONDS)
+      .toTimer();
+    timer.repeatUntilSuccess(new CallableVoid()
+    {
+      @Override
+      public void call() throws Exception
+      {
+        total[0] += getMonitorDelta();
+        assertEquals(total[0], expectedDelta);
+      }
+    });
+  }
+
+  /**
    * Tests the naming conflict resolution code.
    * In this test, the local server act both as an LDAP server and
    * a replicationServer that are inter-connected.
@@ -551,7 +574,7 @@
    * It then uses this session to simulate conflicts and therefore
    * test the naming conflict resolution code.
    */
-  @Test(enabled=true, groups="slow")
+  @Test(enabled=true)
   public void namingConflicts() throws Exception
   {
     testSetUp("namingConflicts");
@@ -750,7 +773,10 @@
       // check that the delete operation has not been applied
       assertNotNull(getEntry(newPersonDN, 10000, true),
           "The DELETE replication message was replayed when it should not");
-      assertEquals(getMonitorDelta(), 1);
+      // The entry already exists, so the getEntry() call above does not wait
+      // for the replay: poll the monitor until the replay thread has resolved
+      // the conflict.
+      waitForMonitorDelta(1);
       assertConflictAutomaticallyResolved(alertCount);
 
 

--
Gitblit v1.10.0