Skip to content

Commit 64c5b0c

Browse files
rjrudinSameeraPriyathamTadikonda
authored andcommitted
DHFPROD-4698: Bumping up logging to error for query roleset issue
Also modifying the test so it only tests for an error on 10.0-3.
1 parent effe616 commit 64c5b0c

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

marklogic-data-hub/src/main/java/com/marklogic/hub/dhs/installer/deploy/DeployHubQueryRolesetsCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected SaveReceipt saveResource(ResourceManager mgr, CommandContext context,
2626
receipt = super.saveResource(mgr, context, payload);
2727
} catch (HttpClientErrorException ex) {
2828
if (isPermissionedDeniedException(ex)) {
29-
logger.info("Received SEC-PERMDENIED error when deploying query roleset; this can be safely ignored if the " +
29+
logger.error("Received SEC-PERMDENIED error when deploying query roleset; this can be safely ignored if the " +
3030
"query roleset already exists in MarkLogic.");
3131
} else {
3232
throw ex;

marklogic-data-hub/src/test/java/com/marklogic/hub/dhs/installer/deploy/DeployHubQueryRolesetsCommandTest.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,21 @@ void test() {
3838
assertEquals(201, receipt.getResponse().getStatusCodeValue(), "The query roleset should have been created " +
3939
"successfully because data-hub-developer has the add-query-rolesets privilege");
4040

41-
receipt = command.saveResource(mgr, new CommandContext(new AppConfig(), userWithRoleBeingTestedClient, null), payload);
42-
assertNull(receipt, "The receipt object will be null because the Manage API threw an exception, since a " +
43-
"user without the security role can't call POST again on a query roleset, and the data-hub-developer " +
44-
"user doesn't have the security role. And a PUT call can't be made because the GET endpoint for a " +
45-
"roleset doesn't support passing in the role names that constitute a roleset, so there's no way to " +
46-
"figure out the roleset ID which would be required by the PUT call." +
47-
"" +
48-
"So instead of an exception being thrown, check the logging to verify that a message was logged " +
49-
"indicating that the SEC-PERMDENIED exception can be safely ignored if the query roleset has already " +
50-
"been deployed. This is the best we can do in DHF based on ML 10.0-3.");
41+
if ("10.0-3".equals(versions.getMarkLogicVersion())) {
42+
receipt = command.saveResource(mgr, new CommandContext(new AppConfig(), userWithRoleBeingTestedClient, null), payload);
43+
assertNull(receipt, "The receipt object will be null because the Manage API threw an exception, since a " +
44+
"user without the security role can't call POST again on a query roleset, and the data-hub-developer " +
45+
"user doesn't have the security role. And a PUT call can't be made because the GET endpoint for a " +
46+
"roleset doesn't support passing in the role names that constitute a roleset, so there's no way to " +
47+
"figure out the roleset ID which would be required by the PUT call." +
48+
"" +
49+
"So instead of an exception being thrown, check the logging to verify that a message was logged " +
50+
"indicating that the SEC-PERMDENIED exception can be safely ignored if the query roleset has already " +
51+
"been deployed. This is the best we can do in DHF based on ML 10.0-3.");
52+
} else {
53+
logger.info("On the nightly build for 10.0-4, the bug with query rolesets has been fixed. " +
54+
"Once 10.0-4 is released, we can update this test to verify the above condition is longer met.");
55+
}
5156
} finally {
5257
// The lack of an exception from this verifies that the roleset was deleted successfully
5358
userWithRoleBeingTestedClient.delete(rolesetPath);

0 commit comments

Comments
 (0)