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

Continuous Testing: add support for build system like test selection #46389

Merged
merged 1 commit into from
Feb 28, 2025

Conversation

Ladicek
Copy link
Contributor

@Ladicek Ladicek commented Feb 20, 2025

This commit adds support for selecting tests to run during continuous testing that is very close to the native test filtering capability of the given build system. That is, in Maven, there's support for the -Dtest=... system property, while in Gradle, there's support for the --tests command line option. Format of these options follows the format used by the build system.

Fixes #20231

@Ladicek Ladicek requested a review from aloubyansky February 20, 2025 12:04
@quarkus-bot quarkus-bot bot added area/core area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/documentation area/gradle Gradle area/maven labels Feb 20, 2025
@Ladicek Ladicek force-pushed the continuous-testing-selection branch from 41fbfd8 to 285f414 Compare February 20, 2025 12:25

This comment has been minimized.

Copy link

github-actions bot commented Feb 20, 2025

🙈 The PR is closed and the preview is expired.

This comment has been minimized.

@Ladicek
Copy link
Contributor Author

Ladicek commented Feb 20, 2025

I tried looking at the Istio tests and I honestly have no idea how they are supposed to work. The kubernetes-client-api-server-url system property doesn't seem to be set to any meaningful value anywhere (as opposed to the Kubernetes invoker tests, which at least do set it). I'll continue digging.

if (specificSelection.startsWith("maven:")) {
launchBuilder.filters(new MavenSpecificSelectionFilter(specificSelection.substring("maven:".length())));
} else if (specificSelection.startsWith("gradle:")) {
launchBuilder.filters(new GradleSpecificSelectionFilter(specificSelection.substring("gradle:".length())));
Copy link
Member

@aloubyansky aloubyansky Feb 20, 2025

Choose a reason for hiding this comment

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

I was wondering whether we could keep build tool-specific parsing somewhere in that build tool integration code (Gradle/Maven plugin impl) and pass a value in an expected format here.
That way we would keep build tool-specific code in the build tool integration module.

That raises the question which format we should adopt here: either our own version or pick one of Maven or Gradle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the Gradle format is super dumb and it could be translated to the Maven format ... if it didn't use a period . as a separator of class name pattern and method name pattern. Figuring out what any given period means would require adding more heuristics to the parsing side which are currently not present (because the decision happens during evaluation).

Also, the place where we have access to the user-provided value is in a different process than the place where we have to apply it. So we have to "serialize" it and then "parse" again anyway. In which case, I figured it would be simplest to pass the Maven-style or Gradle-style string directly, with minimum changes, and parse it in the test runner. The other option would either require defining a custom format, for no good reason, or to creatively use regular expressions, which would be doable, but those regexps would be relatively complex, because they would have to express in one place what we currently can express with multiple relatively simple regexps.

This commit adds support for selecting tests to run during continuous testing
that is very close to the native test filtering capability of the given build
system. That is, in Maven, there's support for the `-Dtest=...` system property,
while in Gradle, there's support for the `--tests` command line option. Format
of these options follows the format used by the build system.
@gsmet gsmet force-pushed the continuous-testing-selection branch from 285f414 to 528ae6b Compare February 27, 2025 20:37
@gsmet
Copy link
Member

gsmet commented Feb 27, 2025

I rebased to check if I finally fixed all the CI issues. Fingers crossed.

Copy link

quarkus-bot bot commented Feb 27, 2025

Status for workflow Quarkus Documentation CI

This is the status report for running Quarkus Documentation CI on commit 528ae6b.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

Warning

There are other workflow runs running, you probably need to wait for their status before merging.

Copy link

quarkus-bot bot commented Feb 27, 2025

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 528ae6b.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.


Flaky tests - Develocity

⚙️ JVM Tests - JDK 17

📦 extensions/hibernate-orm/deployment

io.quarkus.hibernate.orm.applicationfieldaccess.PublicFieldAccessInheritanceTest.testFieldAccess - History

  • Expecting actual not to be null - java.lang.AssertionError
java.lang.AssertionError: 

Expecting actual not to be null
	at io.quarkus.hibernate.orm.applicationfieldaccess.PublicFieldAccessInheritanceTest$FieldAccessEnhancedDelegate$2.assertValue(PublicFieldAccessInheritanceTest.java:152)
	at io.quarkus.hibernate.orm.applicationfieldaccess.PublicFieldAccessInheritanceTest.doTestFieldAccess(PublicFieldAccessInheritanceTest.java:100)
	at io.quarkus.hibernate.orm.applicationfieldaccess.PublicFieldAccessInheritanceTest.testFieldAccess(PublicFieldAccessInheritanceTest.java:61)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at io.quarkus.test.QuarkusUnitTest.runExtensionMethod(QuarkusUnitTest.java:521)

⚙️ JVM Tests - JDK 17 Windows

📦 extensions/micrometer-opentelemetry/deployment

io.quarkus.micrometer.opentelemetry.deployment.compatibility.MicrometerTimedInterceptorTest.testTimeMethod_Failed - History

  • Stream has no elements - java.lang.IllegalArgumentException
java.lang.IllegalArgumentException: Stream has no elements
	at io.quarkus.micrometer.opentelemetry.deployment.common.MetricDataFilter.lastReadingDataPoint(MetricDataFilter.java:236)
	at io.quarkus.micrometer.opentelemetry.deployment.compatibility.MicrometerTimedInterceptorTest.testTimeMethod_Failed(MicrometerTimedInterceptorTest.java:100)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at io.quarkus.test.QuarkusUnitTest.runExtensionMethod(QuarkusUnitTest.java:521)
	at io.quarkus.test.QuarkusUnitTest.interceptTestMethod(QuarkusUnitTest.java:435)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

@Ladicek
Copy link
Contributor Author

Ladicek commented Feb 28, 2025

Thanks! I've attempted investigation in my fork, but couldn't find anything, and now it works :-)

@Ladicek Ladicek requested a review from aloubyansky February 28, 2025 08:05
Copy link
Member

@aloubyansky aloubyansky left a comment

Choose a reason for hiding this comment

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

Great work @Ladicek , thanks!

@aloubyansky aloubyansky merged commit 7ea970e into quarkusio:main Feb 28, 2025
61 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.21 - main milestone Feb 28, 2025
@quarkus-bot quarkus-bot bot added the kind/enhancement New feature or request label Feb 28, 2025
@Ladicek Ladicek deleted the continuous-testing-selection branch March 2, 2025 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/documentation area/gradle Gradle area/maven kind/enhancement New feature or request triage/flaky-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please add -Dtest= option for continuous testing like in maven
3 participants