Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-27970][tests][JUnit5 migration] flink-hadoop-bulk #19970

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

RyanSkraba
Copy link
Contributor

What is the purpose of the change

Update the flink-formats/flink-hadoop-bulk module to AssertJ and JUnit 5 following the JUnit 5 Migration Guide

Brief change log

  • Removed dependences on JUnit 4, JUnit 5 Assertions and Hamcrest where possible.

Verifying this change

This change is a trivial rework / code cleanup without any test coverage.

I've verified that there are 31 tests run in this module before and after the refactoring.

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

@RyanSkraba RyanSkraba force-pushed the FLINK-27970-flink-hadoop-bulk-junit5 branch from df24747 to 49ff7d3 Compare June 15, 2022 13:47
@RyanSkraba RyanSkraba changed the title [FLINK-27885][tests][JUnit5 migration] flink-hadoop-bulk [FLINK-27970][tests][JUnit5 migration] flink-hadoop-bulk Jun 15, 2022
@flinkbot
Copy link
Collaborator

flinkbot commented Jun 15, 2022

CI report:

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

@RyanSkraba
Copy link
Contributor Author

@flinkbot run azure

@RyanSkraba RyanSkraba force-pushed the FLINK-27970-flink-hadoop-bulk-junit5 branch from 49ff7d3 to 1bcdaa4 Compare October 20, 2022 07:46
@RyanSkraba RyanSkraba force-pushed the FLINK-27970-flink-hadoop-bulk-junit5 branch from 1bcdaa4 to a4cf5e4 Compare January 19, 2023 17:37
@RyanSkraba
Copy link
Contributor Author

Hello! I've rebased this PR to master and fixed the merge conflicts in the meantime.

I will be mostly away from my computer for a couple of weeks, but I'll check in if anything changes!

@RyanSkraba RyanSkraba force-pushed the FLINK-27970-flink-hadoop-bulk-junit5 branch from a4cf5e4 to 27712b0 Compare August 24, 2023 16:33
@RyanSkraba RyanSkraba force-pushed the FLINK-27970-flink-hadoop-bulk-junit5 branch from b2c8bbe to 19cb84e Compare January 4, 2024 15:29
@@ -232,7 +227,7 @@ private void verifyFileNotExists(
FileSystem fileSystem = FileSystem.get(basePath.toUri(), configuration);
for (String targetFileName : targetFileNames) {
assertThat(fileSystem.exists(new Path(basePath, targetFileName)))
.as("Pre-committed file should not exists: " + targetFileName)
.as("Pre-committed file should not exist: " + targetFileName)
Copy link
Contributor

Choose a reason for hiding this comment

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

very nit:

Suggested change
.as("Pre-committed file should not exist: " + targetFileName)
.as(() -> "Pre-committed file should not exist: " + targetFileName)

we can use suppliers in order to concat string only in case of failure and do not dot it for success cases

Copy link
Contributor

Choose a reason for hiding this comment

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

interesting feature. I didn't notice that before. But keep in mind two things when writing code:

  1. There's also a trade-off between readability and performance improvement: Not every performance-related change is needed/useful. Here we have a test implementation where we don't need to worry too much about the performance of a String operation in case of a failure. Readability (i.e. less code) might be preferable here because the additional code snippet doesn't add any value. ...at least as far as I can see.
  2. "Workarounds" that are way more "uncommon" in the code base might cause hotfix PRs later on by contributors who do not know this particular feature (which increases the review efforts on the committers' side or, at least, increases the projects PR count). I see that specific risk for this change proposal here. But to be fair, that's a subjective judgement on my end.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree about the points you've mentioned
I suggested that since it seems it is becoming a common approach, e.g. similar things are quite often in Calcite and othe projects...
anyway I'm not insisting on this, up to @RyanSkraba

@@ -245,7 +240,7 @@ private void verifyCommittedFiles(
for (String targetFileName : targetFileNames) {
Path targetFilePath = new Path(basePath, targetFileName);
assertThat(fileSystem.exists(targetFilePath))
.as("Committed file should exists: " + targetFileName)
.as("Committed file should exist: " + targetFileName)
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
.as("Committed file should exist: " + targetFileName)
.as(() -> "Committed file should exist: " + targetFileName)

we can use suppliers in order to concat string only in case of failure and do not dot it for success cases

@Test
@Ignore
@Disabled
public void prepareDeserialization() throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we also harden modifier here?

@snuyanzin
Copy link
Contributor

In general it looks good to me
thanks for working on it @RyanSkraba 👍

I left some minor comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants