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

Jean-Noel Rouvignac
03.21.2013 6b5455aba72709fb4d3841acfd8241508a6f620e
Maybe the end of endless pain and suffering on the Continuous Integration front - take 2.

In ExternalChangeLogTest.ECLReplicationServerFullTest(), debugging somewhat allows to reproduce the problem. The sequence of events is... interesting.
In ECLAfterChangelogTrim(), the last published DeleteMsg might not even have even been received on the other side when the test ends (i.e. ServerReader.run() might never have called/completed calling Session.receive()), hence clearing the changelogDB cannot clear this yet to be received message!
Looking closely at this test, I cannot see any reason to publish this DeleteMsg, so I removed this code. I also took the opportunity to get rid of what look like a useless 1s sleep.

ExternalChangeLogTest.java:
In ECLReplicationServerFullTest(), removed sending a useless DeleteMsg that changes nothing to the test result + removed a useless 1s sleep (Yay!) + removed the call to clearChangelogDB() in the finally block (already called by a @AfterTest)
1 files modified
17 ■■■■ changed files
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ExternalChangeLogTest.java 17 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ExternalChangeLogTest.java
@@ -831,9 +831,7 @@
      assertEquals(searchOp.getSearchEntries().size(), 0);
      String expectedError = ERR_RESYNC_REQUIRED_MISSING_DOMAIN_IN_PROVIDED_COOKIE
          .get("o=test:;","<"+ newCookie + "o=test:;>").toString();
      assertTrue(searchOp.getErrorMessage().toString().equalsIgnoreCase(expectedError),
          "Expected: " + expectedError + "Server output:" +
          searchOp.getErrorMessage());
      assertThat(searchOp.getErrorMessage().toString()).isEqualToIgnoringCase(expectedError);
    }
    finally
    {
@@ -942,7 +940,6 @@
    debugInfo(tn, "Starting test");
    ReplicationBroker server01 = null;
    try
    {
      // ---
@@ -952,7 +949,7 @@
      server01 = openReplicationSession(TEST_ROOT_DN, SERVER_ID_1,
          100, replicationServerPort, brokerSessionTimeout, true);
      final CSN[] csns = generateCSNs(4, SERVER_ID_1);
      final CSN[] csns = generateCSNs(3, SERVER_ID_1);
      publishDeleteMsgInOTest(server01, csns[0], tn, 1);
      Thread.sleep(1000);
@@ -964,9 +961,6 @@
      publishDeleteMsgInOTest(server01, csns[1], tn, 2);
      publishDeleteMsgInOTest(server01, csns[2], tn, 3);
      // Sleep longer than this delay - the changelog will be trimmed
      Thread.sleep(1000);
      // ---
      // 2. Now set up a very short purge delay on the replication changelogs
      // so that this test can play with a trimmed changelog.
@@ -987,6 +981,7 @@
      assertThat(entries).hasSize(0);
      debugAndWriteEntries(ldifWriter, entries, tn);
      // ---
      // 4. Assert that a request with the current last cookie returns nothing
      cookie = readLastCookie();
      debugInfo(tn, "2. Search with last cookie=" + cookie + "\"");
@@ -997,13 +992,10 @@
      assertThat(entries).hasSize(0);
      debugAndWriteEntries(ldifWriter, entries, tn);
      // ---
      // 5. Assert that a request with an "old" cookie - one that refers to
      //    changes that have been removed by the replication changelog trimming
      //    returns the appropriate error.
      publishDeleteMsgInOTest(server01, csns[3], tn, 1);
      debugInfo(tn, "d1 trimdate" + getReplicationDomainStartState(TEST_ROOT_DN));
      debugInfo(tn, "d2 trimdate" + getReplicationDomainStartState(TEST_ROOT_DN2));
      searchOp = searchOnCookieChangelog("(targetDN=*)", cookieNotEmpty, tn, UNWILLING_TO_PERFORM);
@@ -1015,9 +1007,6 @@
    finally
    {
      stop(server01);
      // lets clear the last "changeType: delete" from the changelogDB
      // it is failing to do it on slower machines
      clearChangelogDB(replicationServer);
      // And reset changelog purge delay for the other tests.
      replicationServer.getChangelogDB().setPurgeDelay(15 * 1000);
    }