You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "FrankChen021 (via GitHub)" <gi...@apache.org> on 2026/08/18 12:56:49 UTC
[PR] test(server): migrate PR3 tests to JUnit 5 (druid)
FrankChen021 opened a new pull request, #20061:
URL: https://github.com/apache/druid/pull/20061
## Summary
- Migrate the PR3-owned server tests for Curator, discovery, messages, RPC, general initialization, and segment root/handoff/realtime coverage to JUnit 5.
- Preserve timeout and exception behavior, use explicit Jupiter assertions, and replace JUnit 4 temporary folders with `TemporaryFolderExtension` where needed.
- Keep `server/pom.xml` and shared helpers unchanged; use core Mockito mocks because the server module does not provide `mockito-junit-jupiter`, and add only a local adapter for the inherited JUnit 4 `JsonConfigTesterBase` lifecycle.
Part of #13948
## Validation
- `mvn -ntp -pl server -am test-compile -Dweb.console.skip=true -T1C -Pskip-static-checks` — PASS.
- Focused Curator/discovery/messages/RPC/general-initialization suites — PASS.
- Focused segment root/handoff/realtime suites — PASS, 126 tests.
- `mvn -ntp -pl server -DskipTests -Dweb.console.skip=true checkstyle:check spotbugs:check` — PASS; 0 Checkstyle violations, 0 SpotBugs bugs.
- `git diff --check offical/master` — PASS; no static imports added.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] test(server): migrate PR3 tests to JUnit 5 (druid)
Posted by "FrankChen021 (via GitHub)" <gi...@apache.org>.
FrankChen021 commented on code in PR #20061:
URL: https://github.com/apache/druid/pull/20061#discussion_r3813274946
##########
server/src/test/java/org/apache/druid/rpc/ServiceClientImplTest.java:
##########
@@ -75,24 +69,21 @@ public class ServiceClientImplTest
private ScheduledExecutorService exec;
- @Rule
- public MockitoRule mockitoRule = MockitoJUnit.rule().strictness(Strictness.STRICT_STUBS);
-
- @Mock
private HttpClient httpClient;
- @Mock
private ServiceLocator serviceLocator;
private ServiceClient serviceClient;
- @Before
+ @BeforeEach
public void setUp()
{
+ httpClient = Mockito.mock(HttpClient.class);
Review Comment:
Fixed in 1bd9ba1cbb. Both tests now use the JUnit 5 MockitoExtension with explicit Strictness.STRICT_STUBS and @Mock fields, and server adds the test-scoped mockito-junit-jupiter dependency. Verified with both focused test classes (34 tests), server test-compile, Checkstyle, SpotBugs, and git diff --check.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] test(server): migrate PR3 tests to JUnit 5 (druid)
Posted by "FrankChen021 (via GitHub)" <gi...@apache.org>.
FrankChen021 commented on code in PR #20061:
URL: https://github.com/apache/druid/pull/20061#discussion_r3813157544
##########
server/src/test/java/org/apache/druid/rpc/ServiceClientImplTest.java:
##########
@@ -75,24 +69,21 @@ public class ServiceClientImplTest
private ScheduledExecutorService exec;
- @Rule
- public MockitoRule mockitoRule = MockitoJUnit.rule().strictness(Strictness.STRICT_STUBS);
-
- @Mock
private HttpClient httpClient;
- @Mock
private ServiceLocator serviceLocator;
private ServiceClient serviceClient;
- @Before
+ @BeforeEach
public void setUp()
{
+ httpClient = Mockito.mock(HttpClient.class);
Review Comment:
[P2] Strict Mockito stubbing was dropped
The migration removes Strictness.STRICT_STUBS without a JUnit 5 replacement, so unused or mismatched stubs no longer fail tests. The same regression occurs in SpecificTaskServiceLocatorTest.java. Restore equivalent strict Mockito configuration so test signals are preserved.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] test(server): migrate PR3 tests to JUnit 5 (druid)
Posted by "FrankChen021 (via GitHub)" <gi...@apache.org>.
FrankChen021 merged PR #20061:
URL: https://github.com/apache/druid/pull/20061
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org