Skip to content

[FLINK-25315][tests] add new extensions and utils to help the Junit5 … - #20145

Closed
yuchengxin wants to merge 2 commits into
apache:masterfrom
yuchengxin:FLINK-25315
Closed

yuchengxin wants to merge 2 commits into
apache:masterfrom
yuchengxin:FLINK-25315

Conversation

@yuchengxin

@yuchengxin yuchengxin commented Jul 4, 2022 •

Copy link
Copy Markdown
Contributor

…migration

What is the purpose of the change

This pull request adds new extensions and utils to help the Junit5 migration.

Brief change log

  • Add ParameterizedTestExtension and two annotations to help to migrate the Junit4 parameterized test
  • Add TempDirUtils to provide some common methods in org.junit.rules.TemporaryFolder
  • Migrate LongHashTableTest to Junit5 as an example to show how to use the use ParameterizedTestExtension
  • Migrate PackagedProgramUtilsPipelineTest to Junit5 as an example to show how to TempDirUtils

Verifying this change

This change is already covered by existing tests.

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

@flinkbot

flinkbot commented Jul 4, 2022 •

Copy link
Copy Markdown
Collaborator

CI report:

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

@Myasuka
Myasuka self-requested a review July 4, 2022 05:19
@yuchengxin
yuchengxin force-pushed the FLINK-25315 branch 2 times, most recently from f6d4ea1 to d98a5d9 Compare July 4, 2022 06:59

@Myasuka Myasuka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for creating this PR! Please take a look at my comments.

I tried another test class PackagedProgramUtilsPipelineTest which both have parameterized tests and temp directory usage:

@ExtendWith(ParameterizedTestExtension.class)
public class PackagedProgramUtilsPipelineTest {

    @Parameter
    public TestParameter testParameter;

    @TempDir
    private java.nio.file.Path temporaryFolder;
    @Parameters(name = "testParameter-{0}")
    public static Collection<TestParameter> parameters() {
        return Arrays.asList(
                TestParameter.of(
                        DataSetTestProgram.class,
                        pipeline -> ((Plan) pipeline).getExecutionConfig()),
                TestParameter.of(
                        DataStreamTestProgram.class,
                        pipeline -> ((StreamGraph) pipeline).getExecutionConfig()));
    }

@Myasuka

Myasuka commented Jul 9, 2022

Copy link
Copy Markdown
Member

@yuchengxin Thanks for the update!
I think this PR looks good. Would you please update the description as you already introduced another PackagedProgramUtilsPipelineTest.java test to show how to use TempDirUtils and ParameterizedTestExtension.

@yuchengxin

Copy link
Copy Markdown
Contributor Author

@yuchengxin Thanks for the update! I think this PR looks good. Would you please update the description as you already introduced another PackagedProgramUtilsPipelineTest.java test to show how to use TempDirUtils and ParameterizedTestExtension.

I hive modified the description of this PR

@yuchengxin

Copy link
Copy Markdown
Contributor Author

@flinkbot run azure

1 similar comment
@Myasuka

Myasuka commented Jul 9, 2022

Copy link
Copy Markdown
Member

@flinkbot run azure

@Myasuka Myasuka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the update, LGTM

@Myasuka Myasuka closed this in 3bd3a02 Jul 11, 2022
@Myasuka

Myasuka commented Jul 11, 2022

Copy link
Copy Markdown
Member

Thanks for the contributions from @yuchengxin and previous work done by @ruanhang1993 !

ericccarlson pushed a commit to ericccarlson/flink that referenced this pull request Jul 11, 2022
liujiawinds pushed a commit to liujiawinds/flink that referenced this pull request Jul 22, 2022
huangxiaofeng10047 pushed a commit to huangxiaofeng10047/flink that referenced this pull request Nov 3, 2022
dalelane pushed a commit to dalelane/flink that referenced this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants