-
Notifications
You must be signed in to change notification settings - Fork 74
MLE-23146 Trying another approach with clearDB #1811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR modifies the database clearing mechanism in functional tests to handle intermittent failures more gracefully. Instead of using a blanket wait period, it now catches specific exceptions and logs them with detailed context.
- Replaces fixed 2-second wait with exception handling for database clearing failures
- Adds detailed logging for forest availability errors that occur during Jenkins test runs
- Imports FailedRequestException to handle specific database operation failures
Comments suppressed due to low confidence (1)
marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/ConnectedRESTQA.java:322
- [nitpick] The error message is extremely verbose and contains implementation-specific details that may not be helpful to users. Consider simplifying to focus on the key issue and potential impact rather than including specific file paths and internal error codes.
LoggerFactory.getLogger(ConnectedRESTQA.class).warn("Unable to clear database. This intermittently " +
LoggerFactory.getLogger(ConnectedRESTQA.class).warn("Unable to clear database. This intermittently " + | ||
"happens while running tests on Jenkins, typically with a server error message such as: " + | ||
"XDMP-FORESTNOT: Forest StringQueryHostBatcherDB-1 not available: XDMP-FORESTERR: " + | ||
"Error in clear of forest StringQueryHostBatcherDB-1: SVC-FILREN: File rename error: " + | ||
"rename '/var/opt/MarkLogic/TmpForests/StringQueryHostBatcherDB-1/Journals to " + | ||
"/var/opt/MarkLogic/Forests/StringQueryHostBatcherDB-1/Journals': No such file or directory. " + | ||
"This error is caught and logged in the hopes that proceeding tests will succeed even though " + | ||
"this clearDB call failed.", ex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider catching a more specific exception type or adding additional catch blocks for different failure scenarios. FailedRequestException is quite broad and may catch unrelated database errors that should be handled differently than forest availability issues.
LoggerFactory.getLogger(ConnectedRESTQA.class).warn("Unable to clear database. This intermittently " + | |
"happens while running tests on Jenkins, typically with a server error message such as: " + | |
"XDMP-FORESTNOT: Forest StringQueryHostBatcherDB-1 not available: XDMP-FORESTERR: " + | |
"Error in clear of forest StringQueryHostBatcherDB-1: SVC-FILREN: File rename error: " + | |
"rename '/var/opt/MarkLogic/TmpForests/StringQueryHostBatcherDB-1/Journals to " + | |
"/var/opt/MarkLogic/Forests/StringQueryHostBatcherDB-1/Journals': No such file or directory. " + | |
"This error is caught and logged in the hopes that proceeding tests will succeed even though " + | |
"this clearDB call failed.", ex); | |
String errorMessage = ex.getMessage(); | |
if (errorMessage != null && (errorMessage.contains("XDMP-FORESTNOT") || errorMessage.contains("XDMP-FORESTERR"))) { | |
LoggerFactory.getLogger(ConnectedRESTQA.class).warn("Unable to clear database due to forest-related error. " + | |
"This intermittently happens while running tests on Jenkins, typically with a server error message such as: " + | |
"XDMP-FORESTNOT: Forest StringQueryHostBatcherDB-1 not available: XDMP-FORESTERR: " + | |
"Error in clear of forest StringQueryHostBatcherDB-1: SVC-FILREN: File rename error: " + | |
"rename '/var/opt/MarkLogic/TmpForests/StringQueryHostBatcherDB-1/Journals to " + | |
"/var/opt/MarkLogic/Forests/StringQueryHostBatcherDB-1/Journals': No such file or directory. " + | |
"This error is caught and logged in the hopes that proceeding tests will succeed even though " + | |
"this clearDB call failed.", ex); | |
} else { | |
LoggerFactory.getLogger(ConnectedRESTQA.class).error("Failed to clear database due to an unexpected error.", ex); | |
throw ex; // Rethrow the exception to ensure proper handling. | |
} |
Copilot uses AI. Check for mistakes.
Also making one particular test that intermittently fails a little less worse.
9b9ec90
to
e33267a
Compare
No description provided.