jtuglu-netflix commented on code in PR #18060:
URL: https://github.com/apache/druid/pull/18060#discussion_r2119972329


##########
indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskQueueConcurrencyTest.java:
##########
@@ -77,7 +80,20 @@ public void setUpIngestionTestBase() throws IOException
           @Override
           public ListenableFuture<TaskStatus> run(Task task)
           {
-            return Futures.immediateFuture(TaskStatus.success(task.getId()));
+            // Skip the initialization; we just need to simulate a delayed 
future
+            Preconditions.checkArgument(task instanceof NoopTask, "task must 
be an instance of NoopTask");
+            final SettableFuture<TaskStatus> future = SettableFuture.create();
+
+            taskExecutor.submit(() -> {
+              try {
+                TaskStatus status = ((NoopTask) task).runTask(null);
+                future.set(status);
+              }
+              catch (Exception e) {
+                future.setException(e);
+              }
+            });
+            return future;

Review Comment:
   This test file is currently only testing concurrency correctness between 
"visible" functions being called, but doesn't consider the background callbacks 
which acquire the same locks, etc. that the tested methods do (and hence can 
cause flakes, etc). It's more thorough IMO to include a parameterized runtime 
on the tasks so you can ensure these invisible callbacks' concurrency 
correctness w.r.t to the called methods is also tested.



-- 
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