Skip to content

Commit 9b9ec90

Browse files
committed
MLE-23146 Trying another approach with clearDB
1 parent 14128e4 commit 9b9ec90

File tree

1 file changed

+10
-4
lines changed
  • marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest

1 file changed

+10
-4
lines changed

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/ConnectedRESTQA.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.marklogic.client.DatabaseClient.ConnectionType;
1414
import com.marklogic.client.DatabaseClientBuilder;
1515
import com.marklogic.client.DatabaseClientFactory;
16+
import com.marklogic.client.FailedRequestException;
1617
import com.marklogic.client.admin.ServerConfigurationManager;
1718
import com.marklogic.client.impl.SSLUtil;
1819
import com.marklogic.client.io.DocumentMetadataHandle;
@@ -317,10 +318,15 @@ public static void clearDB(int port) {
317318
try (DatabaseClient client = newDatabaseClientBuilder().withPort(port).build()) {
318319
QueryManager mgr = client.newQueryManager();
319320
mgr.delete(mgr.newDeleteDefinition());
320-
// Clearing the database occasionally causes a forest to not be available for a moment or two when the tests
321-
// are running on Jenkins. This leads to intermittent failures. Waiting is not guaranteed to avoid the
322-
// error but simply hopes to minimize the chance of an intermittent failure.
323-
waitFor(2000);
321+
} catch (FailedRequestException ex) {
322+
LoggerFactory.getLogger(ConnectedRESTQA.class).warn("Unable to clear database. This intermittently " +
323+
"happens while running tests on Jenkins, typically with a server error message such as: " +
324+
"XDMP-FORESTNOT: Forest StringQueryHostBatcherDB-1 not available: XDMP-FORESTERR: " +
325+
"Error in clear of forest StringQueryHostBatcherDB-1: SVC-FILREN: File rename error: " +
326+
"rename '/var/opt/MarkLogic/TmpForests/StringQueryHostBatcherDB-1/Journals to " +
327+
"/var/opt/MarkLogic/Forests/StringQueryHostBatcherDB-1/Journals': No such file or directory. " +
328+
"This error is caught and logged in the hopes that proceeding tests will succeed even though " +
329+
"this clearDB call failed.", ex);
324330
}
325331
}
326332

0 commit comments

Comments
 (0)