Skip to content

Comments

[FLINK-39124] Update flink-tests to JUnit5#27657

Open
mateczagany wants to merge 1 commit intoapache:masterfrom
mateczagany:FLINK-39124
Open

[FLINK-39124] Update flink-tests to JUnit5#27657
mateczagany wants to merge 1 commit intoapache:masterfrom
mateczagany:FLINK-39124

Conversation

@mateczagany
Copy link
Contributor

What is the purpose of the change

Migrate all tests in module flink-tests from JUnit4 to JUnit5.

Brief change log

  • Migrate all test cases to use JUnit5 and AssertJ instead of Hamcrest.
  • Remove @SuppressWarnings where it was unnecessary
  • Restrict visibility of fields where it was possible

Verifying this change

  • I ran each updated tests one by one after migrating them
  • CI should pass

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

@flinkbot
Copy link
Collaborator

flinkbot commented Feb 24, 2026

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Copy link
Contributor

@RocMarshal RocMarshal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mateczagany for the big patch!

I've briefly reviewed and flagged a few representative examples of issues.
Please take a look when you have time.
Also, the current change set might contain too many lines of modifications. It would be helpful for review progress and quality if you could split the PR or commits into categories or thematic groups.

/** An integration test for rate limiting built into the DataGeneratorSource. */
public class RateLimitedSourceReaderITCase extends TestLogger {
@ExtendWith(TestLoggerExtension.class)
public class RateLimitedSourceReaderITCase {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the public be deleted ?

try (CloseableIterator<Long> sumsIterator = sums.executeAndCollect()) {
List<Long> results = CollectionUtil.iteratorToList(sumsIterator);
assertThat(results, equalTo(Arrays.asList(30L, 25L)));
assertThat(results).isEqualTo(Arrays.asList(30L, 25L));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--> containsExactlyXXX

Comment on lines +139 to +140
assertEquals(2, collectSinkOperatorFactory.getSocketTimeoutMillis());
assertEquals(3, collectSinkFunction.getMaxBytesPerBatch());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better if use assertThat.


@Test
public void testInvalidTypeAccumulator() throws Exception {
public void testInvalidTypeAccumulator() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public void testInvalidTypeAccumulator() {
void testInvalidTypeAccumulator() {

@mateczagany
Copy link
Contributor Author

Thank you very much for your review @RocMarshal - I will open other, smaller PRs with the suggested changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants