kfaraz commented on code in PR #13558:
URL: https://github.com/apache/druid/pull/13558#discussion_r1052910255


##########
indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskQueueTest.java:
##########
@@ -350,6 +378,154 @@ public boolean isReady(TaskActionClient taskActionClient)
     );
   }
 
+  @Test
+  public void testHttpRemoteTaskRunnerTaskShutdownMetricsEmission() throws 
EntryExistsException, InterruptedException
+  {
+    final TaskActionClientFactory actionClientFactory = 
createActionClientFactory();
+    final HttpRemoteTaskRunner taskRunner = 
createHttpRemoteTaskRunner(ImmutableList.of("t1"));
+    final StubServiceEmitter metricsVerifier = new 
StubServiceEmitter("druid/overlord", "testHost");
+    WorkerHolder workerHolder = EasyMock.createMock(WorkerHolder.class);
+    EasyMock.expect(workerHolder.getWorker()).andReturn(new Worker("http", 
"worker", "127.0.0.1", 1, "v1", WorkerConfig.DEFAULT_CATEGORY)).anyTimes();
+    workerHolder.incrementContinuouslyFailedTasksCount();
+    EasyMock.expectLastCall();
+    workerHolder.setLastCompletedTaskTime(EasyMock.anyObject());
+    
EasyMock.expect(workerHolder.getContinuouslyFailedTasksCount()).andReturn(1);
+    EasyMock.replay(workerHolder);
+    final TaskQueue taskQueue = new TaskQueue(
+        new TaskLockConfig(),
+        new TaskQueueConfig(null, null, null, null),
+        new DefaultTaskConfig(),
+        getTaskStorage(),
+        taskRunner,
+        actionClientFactory,
+        getLockbox(),
+        metricsVerifier
+    );
+    taskQueue.setActive(true);
+    final Task task = new TestTask(
+        "t1",
+        Intervals.of("2021-01-01/P1D"),
+        ImmutableMap.of(
+            Tasks.FORCE_TIME_CHUNK_LOCK_KEY,
+            false
+        )
+    );
+    taskQueue.add(task);
+    taskQueue.manageInternal();
+    taskRunner.taskAddedOrUpdated(TaskAnnouncement.create(

Review Comment:
   I meant if it is possible to verify the behaviour without calling this 
method `taskAddedOrupdated()`.



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