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-25228][table] Introduce flink-table-test-utils #18255

Closed
wants to merge 5 commits into from

Conversation

slinkydeveloper
Copy link
Contributor

What is the purpose of the change

Goal of this new module is to provide a easy to use module for testing formats, connectors and end users.

The module brings in transitively all the dependencies you need to run a table test and includes a couple of test utilities.

Brief change log

  • Introduce flink-table-test-utils, shipping the existing table assertions and TableFactoryHarness. Both assertions and TableFactoryHarness are marked as @Experimental
  • Expand the existing table assertions
  • Show the usage of the assertions

Verifying this change

The newly introduced assertions are tested in a new test, showing how to use them.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): yes
  • 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? yes
  • If yes, how is the feature documented? JavaDocs

Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
…gh flink-table-test-utils

Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
@flinkbot
Copy link
Collaborator

flinkbot commented Jan 3, 2022

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 0fad0a9 (Mon Jan 03 08:22:36 UTC 2022)

Warnings:

  • 2 pom.xml files were touched: Check for build and licensing issues.
  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@flinkbot
Copy link
Collaborator

flinkbot commented Jan 3, 2022

CI report:

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

Copy link
Contributor

@twalthr twalthr left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @slinkydeveloper. I totally support this PR but I would like to remove confusion in the code base and duplicate code. Let's move classes from table-common and other locations to the new test utils package. If it is only about DataStructureConverter we can also perform a class lookup whether flink-table-runtime is present or not. That should be fine for test utils.

</dependency>

<!-- Required for the assertions -->
<dependency>
Copy link
Contributor

Choose a reason for hiding this comment

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

This already comes in through flink-test-utils-junit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

flink-test-utils pulls flink-test-utils-junit, but we need to redeclare it here as the parent pom somewhere declares it with scope test, so we need to override the scope here. Removing flink-test-utils-junit returns this:

[INFO] org.apache.flink:flink-table-test-utils:jar:1.15-SNAPSHOT
[INFO] +- org.apache.flink:flink-test-utils:jar:1.15-SNAPSHOT:compile
[INFO] |  +- org.apache.flink:flink-test-utils-junit:jar:1.15-SNAPSHOT:test

<artifactId>flink-table-test-utils</artifactId>
<name>Flink : Table : Test Utils</name>
<description>
This module contains test utilities for the Table API/SQL ecosystem.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe document the intention as well: In the future we plan to expose this module to users. It should not contain internal/very specialized testing utilities.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I doubled down, check now :)

flink-table/flink-table-test-utils/pom.xml Outdated Show resolved Hide resolved
@slinkydeveloper
Copy link
Contributor Author

slinkydeveloper commented Jan 5, 2022

@twalthr the reason for placing the classes in two places is to continue to use the asserts in table-common test classpath as well.

If it is only about DataStructureConverter we can also perform a class lookup whether flink-table-runtime is present or not

That's something I can do with some reflections. This way, we can still use the assertions within table-common (without some methods that requires the runtime dep), and then we don't have duplicated code. But we'll still need the shading. Is it ok for you?

@slinkydeveloper
Copy link
Contributor Author

@twalthr ready for another pass

Copy link
Contributor

@twalthr twalthr left a comment

Choose a reason for hiding this comment

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

Thanks for the update @slinkydeveloper. We still need to remove the duplicate TableFactoryHarness.

Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
@slinkydeveloper
Copy link
Contributor Author

@twalthr as discussed, I've removed the table factory harness

Copy link
Contributor

@twalthr twalthr left a comment

Choose a reason for hiding this comment

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

LGTM

twalthr pushed a commit to twalthr/flink that referenced this pull request Jan 6, 2022
@twalthr twalthr closed this in c38ffac Jan 7, 2022
@slinkydeveloper slinkydeveloper deleted the FLINK-25228 branch January 7, 2022 08:14
niklassemmler pushed a commit to niklassemmler/flink that referenced this pull request Feb 3, 2022
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