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-36009] Architecture tests fixes #140

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

Conversation

eskabetxe
Copy link
Member

@eskabetxe eskabetxe commented Aug 28, 2024

  • Created the package "org.apache.flink.connector.jdbc.core.util" to have classes of flink that are Internal and fails on architecture (could be discussed)
    • Precondition for Preconditions
    • VisibleForTest for VisibleForTesting
    • Other under evaluation, we still have 91 offends on "Connector production code must depend only on public API when outside of connector packages"

@eskabetxe
Copy link
Member Author

@RocMarshal @1996fanrui can you check when have time

@Documented
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR})
@PublicEvolving
public @interface VisibleForTest {}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious why it is necessary to create this new class?

I looked at the VisibleForTesting class in Flink and found that it is also annotated as Internal.

Is the reason for introducing this class the same as the purpose of Preconditions?
If so, if we decide to use this approach, we need to modify the relevant configuration items in checkstyle.xml and add the likely comments like the new Preconditions to clarify why need it.
Alternatively, can we initiate a discussion to change the annotations of these classes (VisibleForTesting and Preconditions) in the Flink package to non-internal? (I think there’s probably missed some context in historical discussion about the annotations for related classes from my side. pls correct me if I'm wrong. )

Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

We are duplicating the class because in Flink is annotated with internal and architecture tests fail because of that.. we cannot use any class annotated with internal (this is the same reason for Preconditions and we could have more classes with this problem)

I could revert this changes to allow the discussion, I also think that change on Flink class both classes to non-internal would be great.

Copy link
Contributor

@RocMarshal RocMarshal Oct 9, 2024

Choose a reason for hiding this comment

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

Thx for the comment.
Maybe there’s no rush to modify anything before we reaching a conclusion.

I'm not familiar with the entire testing framework and the use of annotations in Flink, so I couldn't make useful ideas.
If we decide to change the relevant annotations and utility classes to non-internal, we should confirm what impact this will have on the main Flink repository. If the impact is minimal, maybe we can initiate a discussion.

Hi, @MartijnVisser could you help give some ideas about it? Many thanks~ :)

* Preconditions is an Internal class of Flink.
*/
@PublicEvolving
public class Precondition {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we ultimately keep this class, what problems might arise from using the class name Preconditions?
What I mean is that since the comment mentions this is a code copy, perhaps we can just use the package name to differentiate it and keep the original class-name.

Copy link
Member Author

Choose a reason for hiding this comment

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

None, I simple give another name to be more easy to find the right class

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.

Hi, @eskabetxe thx for the pr.
LGTM on the whole.
I left a few of comments. PTAL if you had the free time.

@eskabetxe
Copy link
Member Author

@RocMarshal thanks for your review..

I think I could change this to 2 PRs... one with the new architecture module and another with changes to fix the "Connector production code must depend only on public API when outside of connector packages"
What do you think?

@RocMarshal
Copy link
Contributor

@RocMarshal thanks for your review..

I think I could change this to 2 PRs... one with the new architecture module and another with changes to fix the "Connector production code must depend only on public API when outside of connector packages" What do you think?

good idea. Make sense to me~
BTW, The first PR could be done first, and it might be better to start the second task after we have some results from the discussion ?

@eskabetxe eskabetxe changed the title [FLINK-36009] Architecture tests refactor and fixes [FLINK-36009] Architecture tests fixes Oct 9, 2024
@eskabetxe
Copy link
Member Author

Created another PR only with new module for architecture change here
This is keeped to allow the discussion about the fixes, and will be simplified so the other PR is merged.

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.

2 participants