8000 fix: adding aot compiliation to quarkus tests by shawkins · Pull Request #48891 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

fix: adding aot compiliation to quarkus tests - #48891

Merged
vmuzikar merged 3 commits into
keycloak:mainfrom
shawkins:iss48754-b
May 13, 2026
Merged

vmuzikar merged 3 commits into
keycloak:mainfrom
shawkins:iss48754-b

Conversation

@shawkins
@shawkins shawkins commented May 11, 2026 •
Copy link
Copy Markdown
Contributor

closes: #48846

Adds aot compilation via a system property.

Also a small rebalancing of fast / slow tests.

@shawkins
shawkins requested review from a team as code owners May 11, 2026 17:50
@shawkins
shawkins force-pushed the iss48754-b branch 2 times, most recently from c64982b to 1bcf104 Compare May 11, 2026 21:58
@shawkins
Copy link
Copy Markdown
Contributor Author

It looks like rebalancing isn't needed.

With a few more runs it looks like the total time for the slow/fast ci runs is typically 4-5 minutes faster. That puts us just a little under 30 minutes for each, which I recall was roughly the goal with splitting the test run all those months ago... Seeing the commits going back to 2022 trying to address the perfomance of the quarkus tests makes me think we probably aren't done yet.

After we get this, and the change by @michalvavrik, merged is it worth looking at trying to optimize reaugmentation, or should we just wait until a few more of the long running individual test methods that are applicable for the new test framework and can be moved over as time goes by.

cc @vmuzikar

@michalvavrik
michalvavrik commented May 12, 2026 •
Copy link
Copy Markdown
Member

I don't have much experience with AOT, in order to review properly, I'd need to sit down on this. I can do that this evening at the earliest, but you don't need to wait with a review. If others review before, just merge. I don't expect there is an issue to find.

if (Boolean.getBoolean("kc.quarkus.tests.aot")) {
String version = String.valueOf(runtimeVersion.version().get(0));
if (Integer.parseInt(version) < 25) {
throw new AssertionError("AOT requested, but the java version is less than 25");
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.

Do we need to be this strict? Can we just ignore the kc.quarkus.tests.aot value instead?

Another suggestion I have is to always enable if the JDK version >= 25.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There's an overhead in creating the cache such that for running individual tests, or test methods locally, I don't want it to happen automatically - mentioned on #48846 (comment)

LOG.infof("Creating pre-initialized database %sfor reuse", useAot ? "and aot cache ":"");

try {
CLIResult result = invoke(SCRIPT_CMD, List.of("start-dev", "-Dinit_db_only=true", "-Dkc.config.built=true"));
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.

now we will need to use launch mode exit_before_bootstrap

closes: keycloak#48846

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
@michalvavrik michalvavrik 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.

LGTM

private void addAOTEnvVars() {
File aotFile = getAotFile(getDistPath());
if (aotFile.exists() && !envVars.containsKey("JAVA_OPTS_APPEND")) {
// TODO: we know for certain that the test java is 25+, so we'll set it here
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.

For me this TODO and the same one on line 591 are not actionable as I don't understand them. What is "it"? If it is lines below, why is it "TODO"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When we call out to kc.sh it will look for the JAVA, JAVA_HOME, or just use java on the path. In that last case it can be picking up a java with a different version than the one used to run the test.

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.

understood, thanks

…ycloakDistribution.java

Co-authored-by: Michal Vavřík <43821672+michalvavrik@users.noreply.github.com>
Signed-off-by: Steven Hawkins <shawkins@redhat.com>
pruivo
pruivo previously approved these changes May 13, 2026
@pruivo pruivo 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.

I nitpick about the version check, but it looks good to me if you want to ignore my suggestion 👍
Nice work @shawkins

…ycloakDistribution.java

Co-authored-by: Pedro Ruivo <pruivo@users.noreply.github.com>
Signed-off-by: Steven Hawkins <shawkins@redhat.com>
@shawkins
Copy link
Copy Markdown
Contributor Author

I nitpick about the version check, but it looks good to me if you want to ignore my suggestion 👍 Nice work @shawkins

I applied the change - can't remember why I was using a string initially, but obviously didn't need to.

@vmuzikar vmuzikar left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks.

Comment on lines +238 to +239
// on failure with java 25, the intellijreporter seems to work, but really just throws
// an exception later - https://github.com/approvals/ApprovalTests.Java/issues/800
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you create a follow-up issue so we don't forget to remove this workaround later?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@vmuzikar
vmuzikar merged commit 6b0f96a into keycloak:main May 13, 2026
91 of 155 checks passed
@stianst stianst mentioned this pull request Jun 1, 2026
sashyo pushed a commit to tide-foundation/keycloak-IGA that referenced this pull request Jul 20, 2026
* fix: adding aot compiliation to quarkus tests

closes: keycloak#48846

Signed-off-by: Steve Hawkins <shawkins@redhat.com>

* Update quarkus/tests/junit5/src/main/java/org/keycloak/it/utils/RawKeycloakDistribution.java

Co-authored-by: Michal Vavřík <43821672+michalvavrik@users.noreply.github.com>
Signed-off-by: Steven Hawkins <shawkins@redhat.com>

* Update quarkus/tests/junit5/src/main/java/org/keycloak/it/utils/RawKeycloakDistribution.java

Co-authored-by: Pedro Ruivo <pruivo@users.noreply.github.com>
Signed-off-by: Steven Hawkins <shawkins@redhat.com>

---------

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
Signed-off-by: Steven Hawkins <shawkins@redhat.com>
Co-authored-by: Michal Vavřík <43821672+michalvavrik@users.noreply.github.com>
Co-authored-by: Pedro Ruivo <pruivo@users.noreply.github.com>
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.

Use AOT compiliation to speed up quarkus tests

4 participants

0