gianm commented on code in PR #18358:
URL: https://github.com/apache/druid/pull/18358#discussion_r2259787713


##########
embedded-tests/src/test/java/org/apache/druid/testing/embedded/auth/BasicAuthMsqTest.java:
##########
@@ -334,18 +382,109 @@ public void 
testExportTaskSubmitOverlordWithoutPermission() throws Exception
     );
     securityClient.setPermissionsToRole(ROLE_1, permissions);
 
-    // Allow permissions sync across cluster to avoid flakes
-    Thread.sleep(SYNC_SLEEP);
+    waitForPermissionsToSync();
+
+    final String taskId = IdUtils.getRandomId();
+    MatcherAssert.assertThat(
+        Assertions.assertThrows(
+            Exception.class,
+            () -> userClient.onLeaderOverlord(o -> o.runTask(taskId, 
createExportTask(taskId)))
+        ),
+        ExceptionMatcher.of(Exception.class).expectMessageContains("403 
Forbidden")
+    );
+  }
 
-    String task = createTaskString();
-    StatusResponseHolder statusResponseHolder = 
overlordResourceTestClient.submitTaskAndReturnStatusWithAuth(task, USER_1, 
USER_1_PASSWORD);
-    Assert.assertEquals(HttpResponseStatus.FORBIDDEN, 
statusResponseHolder.getStatus());
+  private Task createExportTask(String taskId)

Review Comment:
   Sure, you can remove it then. I don't think submitting a controller task 
adds meaningful testing if the `/druid/v2/sql/task` endpoint is already being 
tested. It will submit a task under the hood. And users aren't meant to be 
submitting controller tasks manually anyway.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to