From 9145b0d20cb422d51ee0ee393b69fc3a1457ad11 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 17 Sep 2013 13:30:09 +0000
Subject: [PATCH] ExternalChangeLogTest.java: Attempt at fixing random failures for ECLReplicationServerFullTest() in Jenkins. It fails because a search finds an additional entry with "targetDN: uid=eclafterchangelogtrim1,o=test" which obviously comes from ECLAfterChangelogTrim() method. It looks like this methods are run in parallel, but ReplicationTestCase (ExternalChangeLogTest superclass) specifies to run tests sequentially. I am trying to duplicate this annotation in ExternalChangeLogTest in the hope Jenkins will obey it.

---
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ExternalChangeLogTest.java |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ExternalChangeLogTest.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ExternalChangeLogTest.java
index ec1dc01..88c04c5 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ExternalChangeLogTest.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ExternalChangeLogTest.java
@@ -67,10 +67,7 @@
 import org.opends.server.workflowelement.externalchangelog.ECLWorkflowElement;
 import org.opends.server.workflowelement.localbackend.LocalBackendModifyDNOperation;
 import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
+import org.testng.annotations.*;
 
 import static org.assertj.core.api.Assertions.*;
 import static org.opends.messages.ReplicationMessages.*;
@@ -86,6 +83,9 @@
  * Tests for the replicationServer code.
  */
 @SuppressWarnings("javadoc")
+// repeating the @Test annotation here to try to ensure the tests are run
+// singleThreaded and avoid random failures in continuous integration
+@Test(groups = { "precommit", "replication" }, sequential = true)
 public class ExternalChangeLogTest extends ReplicationTestCase
 {
 
@@ -197,7 +197,7 @@
   @Test(enabled=true, dependsOnMethods = { "ECLReplicationServerTest"})
   public void ECLReplicationServerTest2() throws Exception
   {
-    // Test ECL after changelog triming
+    // Test ECL after changelog trimming
     ECLAfterChangelogTrim();
   }
 
@@ -666,7 +666,6 @@
       // Expect only entry from o=test returned
       entries = searchOp.getSearchEntries();
       assertThat(entries).hasSize(1);
-      entries.get(0);
       debugAndWriteEntries(null, entries, tn);
 
       // Test lastExternalChangelogCookie attribute of the ECL
@@ -675,7 +674,6 @@
           new MultiDomainServerState("o=test:" + csn1 + ";");
 
       String lastCookie = readLastCookie();
-
       assertTrue(expectedLastCookie.equalsTo(new MultiDomainServerState(lastCookie)),
           " Expected last cookie attribute value:" + expectedLastCookie +
           " Read from server: " + lastCookie + " are equal :");
@@ -956,7 +954,7 @@
         null);
   }
 
-  /** Test ECL content after replication changelogdb triming */
+  /** Test ECL content after replication changelogDB trimming */
   private void ECLAfterChangelogTrim() throws Exception
   {
     String tn = "ECLAfterChangelogTrim";

--
Gitblit v1.10.0