[FLINK-27885][tests][JUnit5 migration] flink-csv
What is the purpose of the change
Update the flink-formats/flink-csv module to AssertJ and JUnit 5 following the JUnit 5 Migration Guide
I used the https://github.com/slinkydeveloper/assertj-migrator as the starting point
Most of the AssertJ work was already finished on this module, with some exceptions around error handling.
There are some tests that still depend on JUnit4 test base classes outside this module. These cross-module tests should probably be simultaneously migrated in a separate PR.
I've verified that there are 132 tests run before and after the refactoring.
Brief change log
- Removed dependences on JUnit 4, JUnit 5 Assertions and Hamcrest where possible.
Verifying this change
This change is a code cleanup without any test coverage.
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
Brief change log
(for example:)
- The TaskInfo is stored in the blob store on job creation time as a persistent artifact
- Deployments RPC transmits only the blob storage reference
- TaskManagers retrieve the TaskInfo from the blob cache
CI report:
- ce69d923f41cad97fc783ebed7e6722f9b1d5441 UNKNOWN
- 2bdf90e5438644e6c89ff94ec8d4be8d02f5732f Azure: SUCCESS
Bot commands
The @flinkbot bot supports the following commands:@flinkbot run azurere-run the last Azure build
Rebased with no additional code changes.
Thanks for the contribution @RyanSkraba I have some proposal to improve
- It seems
org.apache.flink.formats.csv.CsvFilesystemBatchITCaseis still not migrated org.apache.flink.formats.csv.CsvFormatFilesystemStatisticsReportTestlooks migrated however modifiers could be hardenedorg.apache.flink.formats.csv.CsvFormatStatisticsReportTestis with junit5 however modifiers could be hardened
Thanks for the review -- I've addressed the comments, except for org.apache.flink.formats.csv.CsvFilesystemBatchITCase which is based on a hierarchy of tests across modules that need to be migrated together.
I typically leave these to be migrated at the same time later (and in this case will likely be a big undertaking as there are at least 76 classes in the hierarchy).
thanks for addressing comments
I noticed that there is a bunch of classes still relying on junit4
org.apache.flink.formats.csv.CsvFileCompactionITCase
org.apache.flink.formats.csv.CsvFilesystemBatchITCase
org.apache.flink.formats.csv.CsvFilesystemStreamITCase
org.apache.flink.formats.csv.CsvFilesystemStreamSinkITCase
because they depend on classes/hierarchies from other modules ...
I wonder if in this case there should be a dedicated follow up task created to fix that... Because currently we can not say that flink-csv is moved to junit5... WDYT?
Also cc @XComp may be you have some clue about that?
Theoretically, we might want to link FLINK-27885 with FLINK-29541. I guess, mentioning in FLINK-29541 that files in other modules need to be migrated as well is sufficient enough. :thinking:
Hello! I missed replying to this last comment -- my strategy for tests that are part of a large (or in this case, very large hierarchy) of related, cross-modules tests is to:
- note it in the PR description and
- go ahead with migrating as much as possible outside of those tests.
I don't see any satisfying incremental approach to cross-module JUnit tests otherwise.
I have no objection to leaving the JIRA open of course! Two PRs can address a single JIRA.
Hello! I've rebased this PR to master. I don't believe there are any remaining requested changes that I haven't addressed (by comment or other).
I will be mostly away from my computer for a couple of weeks, but I'll check in if anything changes!
Hello! I've rebased this PR, did a quick check for changes that may have occurred on master in the meantime, and did some JIRA secretarial work for tracking the changes that were left for later. Thanks!