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

Valery Kharseko
16 hours ago f872566aafe7dd516fd50b5cb8ce6b3002746e71
Fix and enable broken tests from the slow group (#686)
3 files modified
66 ■■■■ changed files
opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java 36 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/TopologyViewTest.java 23 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/tasks/TestRebuildTask.java 7 ●●●●● patch | view | raw | blame | history
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);
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/TopologyViewTest.java
@@ -13,9 +13,12 @@
 *
 * Copyright 2008-2010 Sun Microsystems, Inc.
 * Portions Copyright 2011-2016 ForgeRock AS.
 * Portions Copyright 2026 3A Systems, LLC
 */
package org.opends.server.replication.plugin;
import static java.util.concurrent.TimeUnit.*;
import static org.opends.server.TestCaseUtils.*;
import static org.testng.Assert.*;
@@ -42,6 +45,8 @@
import org.opends.server.replication.protocol.ProtocolVersion;
import org.opends.server.replication.server.ReplServerFakeConfiguration;
import org.opends.server.replication.server.ReplicationServer;
import org.opends.server.util.TestTimer;
import org.opends.server.util.TestTimer.CallableVoid;
import org.testng.annotations.Test;
/**
@@ -469,7 +474,7 @@
   * in DS1,DS2,DS5,DS6)
   * @throws Exception If a problem occurred
   */
  @Test(enabled = true, groups = "slow")
  @Test(enabled = true)
  public void testTopologyChanges() throws Exception
  {
    String testCase = "testTopologyChanges";
@@ -929,10 +934,20 @@
   * with the theoretical topology view that every body should have at the time
   * this method is called.
   */
  private void checkTopoView(int[] dsIdList, TopoView theoricalTopoView)
  private void checkTopoView(final int[] dsIdList, final TopoView theoricalTopoView)
      throws Exception
  {
   Thread.sleep(500);
    // Topology messages are propagated asynchronously: poll until every DS
    // sees the expected view instead of relying on a fixed sleep.
    TestTimer timer = new TestTimer.Builder()
      .maxSleep(30, SECONDS)
      .sleepTimes(100, MILLISECONDS)
      .toTimer();
    timer.repeatUntilSuccess(new CallableVoid()
    {
      @Override
      public void call() throws Exception
      {
   for(int currentDsId : dsIdList)
   {
     LDAPReplicationDomain rd = null;
@@ -981,6 +996,8 @@
     assertEquals(dsTopoView, theoricalTopoView, " in DSid=" + currentDsId);
   }
  }
    });
  }
  /**
   * Bag class representing a view of the topology at a given time
opendj-server-legacy/src/test/java/org/opends/server/tasks/TestRebuildTask.java
@@ -13,6 +13,7 @@
 *
 * Copyright 2006-2009 Sun Microsystems, Inc.
 * Portions Copyright 2011-2014 ForgeRock AS.
 * Portions Copyright 2026 3A Systems, LLC
 */
package org.opends.server.tasks;
@@ -106,7 +107,6 @@
                   "ds-task-class-name: org.opends.server.tasks.RebuildTask",
                   "ds-task-rebuild-base-dn: " + suffix,
                   "ds-task-rebuild-index: dn2id",
                   "ds-task-rebuild-index: dn2uri",
                   "ds-task-rebuild-index: mail"
              ),
              TaskState.COMPLETED_SUCCESSFULLY
@@ -120,15 +120,14 @@
                   "objectclass: ds-task-rebuild",
                   "ds-task-class-name: org.opends.server.tasks.RebuildTask",
                   "ds-task-rebuild-base-dn: ou=bad," + suffix,
                   "ds-task-rebuild-index: dn2id",
                   "ds-task-rebuild-index: dn2uri"
                   "ds-task-rebuild-index: dn2id"
              ),
              TaskState.STOPPED_BY_ERROR
         },
    };
  }
   @Test(dataProvider = "taskentry", groups = "slow")
   @Test(dataProvider = "taskentry")
  public void testRebuildTask(Entry taskEntry, TaskState expectedState)
       throws Exception
  {