You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "spuru9 (via GitHub)" <gi...@apache.org> on 2026/06/20 10:23:21 UTC
[PR] [FLINK-39769][tests][JUnit5 migration] Module: flink-examples-streaming [flink]
spuru9 opened a new pull request, #28496:
URL: https://github.com/apache/flink/pull/28496
## What is the purpose of the change
Migrate the remaining JUnit 4 tests in `flink-examples/flink-examples-streaming` to JUnit 5 (Jupiter). After this PR the module has zero JUnit 4 imports. Part of the umbrella JUnit 4 → 5 migration.
JIRA: [FLINK-39769](https://issues.apache.org/jira/browse/FLINK-39769) (sub-task of [FLINK-25325](https://issues.apache.org/jira/browse/FLINK-25325))
## Brief change log
Three test classes migrated:
- **`StreamingExamplesITCase`** and **`SocketWindowWordCountITCase`** (parameterized):
- `@RunWith(Parameterized.class)` → `@ExtendWith(ParameterizedTestExtension.class)`.
- `@Parameterized.Parameter` → `@Parameter`; `@Parameterized.Parameters` → `@Parameters(name = ...)`.
- `@Test` → `@TestTemplate` (required for the parameterized extension).
- `extends AbstractTestBaseJUnit4` → `extends AbstractTestBase` (the JUnit 5 sibling).
- `org.junit.Assert.fail` → `org.assertj.core.api.Assertions.fail` (`SocketWindowWordCountITCase`).
- **`TopSpeedWindowingExampleITCase`**:
- `@ClassRule MiniClusterWithClientResource` → `@RegisterExtension static MiniClusterExtension`.
- `@ClassRule TemporaryFolder` → `@TempDir static File`; `newFile()`/`newFolder()` → `new File(tempDir, ...)`.
- Drop `extends TestLogger`; `org.junit.Test` → `org.junit.jupiter.api.Test`.
- Drop `public` on test classes and methods per the Flink JUnit 5 Migration Guide.
No production code is touched.
## Verifying this change
This change is a test-only migration covered by the existing tests it migrates:
```
./mvnw -pl flink-examples/flink-examples-streaming test \
-Dtest='StreamingExamplesITCase,TopSpeedWindowingExampleITCase,SocketWindowWordCountITCase'
```
Result: **11 tests run, 0 failures, 0 errors, 0 skipped** (`StreamingExamplesITCase` 8, `SocketWindowWordCountITCase` 2, `TopSpeedWindowingExampleITCase` 1), matching the pre-migration baseline.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): (no)
- The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
- The serializers: (no)
- The runtime per-record code paths (performance sensitive): (no)
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
- The S3 file system connector: (no)
## Documentation
- Does this pull request introduce a new feature? (no)
- If yes, how is the feature documented? (not applicable)
---
##### Was generative AI tooling used to co-author this PR?
- [x] Yes — Claude Code
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-39769][tests][JUnit5 migration] Module: flink-examples-streaming [flink]
Posted by "spuru9 (via GitHub)" <gi...@apache.org>.
spuru9 commented on code in PR #28496:
URL: https://github.com/apache/flink/pull/28496#discussion_r3455157997
##########
flink-examples/flink-examples-streaming/src/test/java/org/apache/flink/streaming/test/examples/windowing/TopSpeedWindowingExampleITCase.java:
##########
@@ -20,37 +20,37 @@
import org.apache.flink.runtime.testutils.MiniClusterResourceConfiguration;
import org.apache.flink.streaming.examples.windowing.TopSpeedWindowing;
import org.apache.flink.streaming.examples.windowing.util.TopSpeedWindowingExampleData;
-import org.apache.flink.test.util.MiniClusterWithClientResource;
+import org.apache.flink.test.junit5.MiniClusterExtension;
import org.apache.flink.util.FileUtils;
-import org.apache.flink.util.TestLogger;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
import java.io.File;
import static org.apache.flink.test.util.TestBaseUtils.compareResultsByLinesInMemory;
/** Tests for {@link TopSpeedWindowing}. */
-public class TopSpeedWindowingExampleITCase extends TestLogger {
+class TopSpeedWindowingExampleITCase {
Review Comment:
Fixed. Added the extension file taking reference from https://github.com/apache/flink/pull/19716,
Didnt add test-jar exclude, nothing consumes this module's test-jar, let me know if we want to add it for caution or another reason.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-39769][tests][JUnit5 migration] Module: flink-examples-streaming [flink]
Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin merged PR #28496:
URL: https://github.com/apache/flink/pull/28496
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-39769][tests][JUnit5 migration] Module: flink-examples-streaming [flink]
Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #28496:
URL: https://github.com/apache/flink/pull/28496#discussion_r3454898207
##########
flink-examples/flink-examples-streaming/src/test/java/org/apache/flink/streaming/test/examples/windowing/TopSpeedWindowingExampleITCase.java:
##########
@@ -20,37 +20,37 @@
import org.apache.flink.runtime.testutils.MiniClusterResourceConfiguration;
import org.apache.flink.streaming.examples.windowing.TopSpeedWindowing;
import org.apache.flink.streaming.examples.windowing.util.TopSpeedWindowingExampleData;
-import org.apache.flink.test.util.MiniClusterWithClientResource;
+import org.apache.flink.test.junit5.MiniClusterExtension;
import org.apache.flink.util.FileUtils;
-import org.apache.flink.util.TestLogger;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
import java.io.File;
import static org.apache.flink.test.util.TestBaseUtils.compareResultsByLinesInMemory;
/** Tests for {@link TopSpeedWindowing}. */
-public class TopSpeedWindowingExampleITCase extends TestLogger {
+class TopSpeedWindowingExampleITCase {
Review Comment:
why logger just disapeared?
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-39769][tests][JUnit5 migration] Module: flink-examples-streaming [flink]
Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #28496:
URL: https://github.com/apache/flink/pull/28496#issuecomment-4757356750
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "193b35bf78a1d62231a222d6241379b242db9569",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "193b35bf78a1d62231a222d6241379b242db9569",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 193b35bf78a1d62231a222d6241379b242db9569 UNKNOWN
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run azure` re-run the last Azure build
</details>
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-39769][tests][JUnit5 migration] Module: flink-examples-streaming [flink]
Posted by "spuru9 (via GitHub)" <gi...@apache.org>.
spuru9 commented on PR #28496:
URL: https://github.com/apache/flink/pull/28496#issuecomment-4771309488
Done — switched both to native `@ParameterizedTest + @ValueSource(booleans = {false, true})`. I'd originally reached for ParameterizedTestExtension since it's the migration guide's drop-in for `@RunWith(Parameterized.class)`, but you're right that native parameterization is cleaner here. Thanks!
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-39769][tests][JUnit5 migration] Module: flink-examples-streaming [flink]
Posted by "spuru9 (via GitHub)" <gi...@apache.org>.
spuru9 commented on PR #28496:
URL: https://github.com/apache/flink/pull/28496#issuecomment-4768643260
cc: @raminqaf @snuyanzin Can you review this PR as well on JUnit5 migration.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-39769][tests][JUnit5 migration] Module: flink-examples-streaming [flink]
Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #28496:
URL: https://github.com/apache/flink/pull/28496#discussion_r3454261420
##########
flink-examples/flink-examples-streaming/src/test/java/org/apache/flink/streaming/test/socket/SocketWindowWordCountITCase.java:
##########
@@ -35,24 +37,23 @@
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
-import java.util.Arrays;
-import java.util.Collection;
+import java.util.List;
-import static org.junit.Assert.fail;
+import static org.assertj.core.api.Assertions.fail;
/** Tests for {@link SocketWindowWordCount}. */
-@RunWith(Parameterized.class)
-public class SocketWindowWordCountITCase extends AbstractTestBaseJUnit4 {
+@ExtendWith(ParameterizedTestExtension.class)
+class SocketWindowWordCountITCase extends AbstractTestBase {
- @Parameterized.Parameter public boolean asyncState;
+ @Parameter private boolean asyncState;
- @Parameterized.Parameters
- public static Collection<Boolean> setup() {
- return Arrays.asList(false, true);
+ @Parameters(name = "asyncState: {0}")
+ public static List<Boolean> parameters() {
+ return List.of(false, true);
}
Review Comment:
why do we need it?
can we just use
```java
@ParameterizedTest
@Values(true, false)
```
?
same for others
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org