Copilot commented on code in PR #19922:
URL: https://github.com/apache/druid/pull/19922#discussion_r3737640102
##########
indexing-service/src/test/java/org/apache/druid/indexing/overlord/http/OverlordTest.java:
##########
@@ -264,16 +265,17 @@ public MockTaskRunner get()
EmittingLogger.registerEmitter(serviceEmitter);
}
- @Test(timeout = 60_000L)
+ @Timeout(60)
+ @Test
public void testOverlordRun() throws Exception
{
// basic task master lifecycle test
overlord.start();
while (!overlord.isLeader()) {
Thread.sleep(10);
}
- Assert.assertEquals(overlord.getCurrentLeader(),
druidNode.getHostAndPort());
- Assert.assertEquals(Optional.absent(), overlord.getRedirectLocation());
+ Assertions.assertEquals(overlord.getCurrentLeader(),
druidNode.getHostAndPort());
Review Comment:
`Assertions.assertEquals` arguments are reversed here; JUnit expects
(expected, actual). Keeping the conventional order improves failure messages
and avoids confusion when diagnosing test failures.
##########
indexing-service/src/test/java/org/apache/druid/indexing/overlord/http/security/SupervisorResourceFilterTest.java:
##########
@@ -150,8 +150,8 @@ public void testSupervisorNotFound()
expected = e;
}
- Assert.assertNotNull(expected);
- Assert.assertEquals(expected.getResponse().getStatus(),
Response.Status.NOT_FOUND.getStatusCode());
+ Assertions.assertNotNull(expected);
+ Assertions.assertEquals(expected.getResponse().getStatus(),
Response.Status.NOT_FOUND.getStatusCode());
Review Comment:
`Assertions.assertEquals` arguments are reversed here; JUnit expects
(expected, actual). Reordering improves the assertion failure output.
##########
indexing-service/src/test/java/org/apache/druid/indexing/overlord/http/security/TaskResourceFilterTest.java:
##########
@@ -81,8 +81,8 @@ public void testTaskNotFound()
catch (WebApplicationException e) {
expected = e;
}
- Assert.assertNotNull(expected);
- Assert.assertEquals(expected.getResponse().getStatus(),
Response.Status.NOT_FOUND.getStatusCode());
+ Assertions.assertNotNull(expected);
+ Assertions.assertEquals(expected.getResponse().getStatus(),
Response.Status.NOT_FOUND.getStatusCode());
Review Comment:
`Assertions.assertEquals` arguments are reversed here; JUnit expects
(expected, actual). Reordering improves the assertion failure output.
##########
indexing-service/src/test/java/org/apache/druid/indexing/overlord/ThreadingTaskRunnerTest.java:
##########
@@ -85,8 +85,8 @@ public TaskStatus runTask(TaskToolbox toolbox)
});
TaskStatus status = statusFuture.get();
Review Comment:
Repository style requires using `final` for locals that are not reassigned
(AGENTS.md:40).
##########
indexing-service/src/test/java/org/apache/druid/indexing/overlord/WorkerTaskRunnerQueryAdpaterTest.java:
##########
@@ -118,21 +118,24 @@ public void testDisableWorkerWhenWorkerRaisesError()
throws Exception
try {
workerTaskRunnerQueryAdapter.disableWorker("worker-host1");
- Assert.fail("Should raise RE exception!");
+ Assertions.fail("Should raise RE exception!");
}
catch (RE re) {
Review Comment:
This test still uses a try/catch + `fail()` pattern to assert an exception.
In JUnit 5, prefer `Assertions.assertThrows` for clearer intent and better
failure diagnostics.
This issue also appears on line 164 of the same file.
##########
indexing-service/src/test/java/org/apache/druid/indexing/overlord/duty/UnusedSegmentsKillerTest.java:
##########
@@ -61,7 +62,6 @@
public class UnusedSegmentsKillerTest
{
- @Rule
public TaskActionTestKit taskActionTestKit = new TaskActionTestKit();
Review Comment:
Repository style requires using `final` for fields that are not reassigned
(AGENTS.md:40). This helper does not need to be `public`.
--
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]