-
Notifications
You must be signed in to change notification settings - Fork 13.9k
[FLINK-27476][test] build import option only focuses on maven main class files #19624
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-27476][test] build import option only focuses on maven main class files #19624
Conversation
zentol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you expand on what concrete issue you're trying to solve?
There is supposed to be some issue with testcontainers; what exactly is it?
...rchitecture-tests-base/src/main/java/org/apache/flink/architecture/common/ImportOptions.java
Outdated
Show resolved
Hide resolved
...rchitecture-tests-base/src/main/java/org/apache/flink/architecture/common/ImportOptions.java
Outdated
Show resolved
Hide resolved
I got issue while testing the external ES connector. The excluding style import option just excludes some known paths which is not a stable solution. It will break if, in this case, any test classes are found in other path. I have run the same archunit test 1. alone, 2. in Idea, 3. with ITCase which needs testContainer together. Only the third one failed. |
9f84ab5 to
f5a4b10
Compare
|
@flinkbot run azure |
|
Can you give me an example for one such "other path" (and ideally a violation as well)? I'm curious why we'd have issues now with the external repo when the same tests seem to work just fine in the flink repo. |
|
In the external connector repo, the [1] https://github.com/apache/flink-connector-elasticsearch/pull/10/files#diff-2f93acbdbdf55f0be081d4c7760ed5bd67706ab609b0657b63a8c031dd4dd55a |
|
So where does archunit pick up the es-base classes from? Does it just read the classpath? I see that |
|
Like this: |
|
there are other ImportOptions that are working on jar and archive: |
|
Have you tried whether |
Yes, that could fix it, thanks! And I think the import option I built in this PR is still very helpful for the future development, because it is more precise. WDYT? |
|
I don't necessarily mind it, but do think that we should figure out the responsibilities a bit. Currently, a test can select certain classes to test via the ImportOptions. This newly added import option would push the responsibility of selecting production code to the test. So who's responsible for selecting production source code? And if we're going with both the user and rule having the capability to do so, then they should rely on the same logic. |
|
Conceptually, you are right. As far as I understood, they have two different responsibilities. |
|
@Airblader After talking with @zentol offline and checking the archunit doc again. I think, theoretically, class path should only be managed by the test via |
|
Originally this was done through the predicate because the idea was to build the class graph only once. Since test code is now tested per-module anyway, I don't see a reason why this couldn't instead be done on the classpath scanning level already. |
|
Thanks for the feedback. If I understood you correctly, we should keep the |
|
If you use the new import option the source predicate filters nothing; if anything it should cost performance. For the Flink production tests it also filters nothing, so it's again costing us. |
|
Thanks for your feedback @zentol, I addressed your comments, please take a look. |
What is the purpose of the change
ImportOption.DoNotIncludeTests.class used currently has some issue when running test with testContainer. It would be good to define the target class path precisely.
The excluding style import option just excludes some known paths which is not a stable solution. It will break if, in this case, any test classes are found in other path. While running the same archunit test 1. alone via maven, 2. in Idea, 3. with ITCase which needs testContainer together via maven for the external connector repo FLINK-27061, only the third one failed.
Brief change log
MavenMainClassesOnlyVerifying this change
ImportOptions.MavenMainClassesOnly.classcould be used within @AnalyzeClasses(...)Does this pull request potentially affect one of the following parts:
@Public(Evolving): (yes / no)Documentation