8000 Refactor and unify RunOnServer modules by vaceksimon · Pull Request #48363 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Refactor and unify RunOnServer modules - #48363

Merged
stianst merged 1 commit into
keycloak:mainfrom
vaceksimon:48319-Testing-client-and-RunOnServer
May 6, 2026
Merged

stianst merged 1 commit into
keycloak:mainfrom
vaceksimon:48319-Testing-client-and-RunOnServer

Conversation

@vaceksimon
@vaceksimon vaceksimon commented Apr 22, 2026 •
Copy link
Copy Markdown
Contributor

Closes #48707

To make migrating tests easier for RunOnServer added TestingResource methods to RunHelpers. To have only one copy, I removed legacy test suite's runonserver code and added a dependency to the new test framework.

What changed:

  • Deleted the old RunOnServer, FetchOnServer, SerializationUtil, etc. from testsuite/integration-arquillian/
  • Made testsuite-providers depend on keycloak-test-framework-remote-providers
  • Updated the Quarkus test server build to copy the framework's run-on-server JAR into the providers directory

Other cleanup:

  • Moved RunHelpers to tests/utils-shared so both test suites can use it
  • Updated imports throughout the codebase

@stianst stianst 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.

This can be simplified and made cleaner.

For example if you have RunOnServerUtils has something like:

    public static RunOnServer printRealm(String realm) {
        return session -> System.out.println(session.realms().getRealmByName(realm).getDisplayName());
    }

Then you can use it with runOnServer.run(RunOnServerUtils.printRealm("asdfsadf")), which removes the need to have the session -> part and also passing session to the method.

You should probably also call it RunOnServerHelpers instead of Utils as that's what we have used for those things in the past.

Finally, this shouldn't be part of the test-framework as these are very internal things, that we don't want to expose. So just add it to the tests/base.

@stianst
stianst commented Apr 22, 2026
Copy link
Copy Markdown
Contributor

@vaceksimon should be in /tests/utils-shared I guess so we can refactor the old testsuite to use these instead of testingResource?

@vaceksimon
Copy link
Copy Markdown
Contributor Author

Well, right now I have two versions of RunOnServerHelpers (or RunOnServerUtils) because the old test suite still calls the testing resource, and the new one uses our run on server. If you're thinking about having a single helper class, I don't know how it could still be used by both test suites.

Besides, I don't think we get more benefit from moving it to /tests/utils-shared as long as the two versions have the same package name, right? @stianst

@vaceksimon
Copy link
Copy Markdown
Contributor Author

@stianst or maybe this new helper should be merged with the already existing RunHelpers

@lhanusov lhanusov 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.

Hi Simon, thank you for this PR @vaceksimon.

I think using RunHelpers is fine, also moving it to the utils-shared folder for a temporary time. But splitting the remote-providers doesn't make sense, it creates a dependency mess.

I think, you should adjust old test suite into a new one not vise versa (old TimeOffset provider has different package name). Please revert those module changes.

Also move the LoginTest migration into a separate PR.

Wdyt?

cc @stianst

<dependency>
<groupId>org.keycloak.testframework</groupId>
<artifactId>keycloak-test-framework-remote-runonserver</artifactId>
<version>999.0.0-SNAPSHOT</version>
@lhanusov lhanusov May 4, 2026 •
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.

shouldn't it be

Suggested change
<version>999.0.0-SNAPSHOT</version>
<version>${keycloak.version}</version>

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.

good catch, thanks

@vaceksimon
Copy link
Copy Markdown
Contributor Author

Thanks @lhanusov

I think using RunHelpers is fine, also moving it to the utils-shared folder for a temporary time. But splitting the remote-providers doesn't make sense, it creates a dependency mess.

Yeah, spliting the module doesn't provide any real benefits, I'll revert that

Also move the LoginTest migration into a separate PR.

Yep, I rewrote only one test method to see the run on server works in both test suites.

@vaceksimon
vaceksimon force-pushed the 48319-Testing-client-and-RunOnServer branch from 407e0df to 19e2af1 Compare May 5, 2026 11:00
Signed-off-by: Simon Vacek <simonvacky@email.cz>
@vaceksimon
vaceksimon force-pushed the 48319-Testing-client-and-RunOnServer branch from 19e2af1 to dae0b82 Compare May 5, 2026 11:02
@vaceksimon
vaceksimon marked this pull request as ready for review May 5, 2026 12:25
@vaceksimon
vaceksimon requested review from a team as code owners May 5, 2026 12:25
@vaceksimon
vaceksimon requested review from lhanusov and stianst May 5, 2026 12:25
@vaceksimon vaceksimon changed the title Unify Testing client and RunOnServer APIs for smoother test migration Refactor and unify RunOnServer modules May 5, 2026
@stianst
stianst merged commit ccdf982 into keycloak:main May 6, 2026
90 checks passed
@vaceksimon
vaceksimon deleted the 48319-Testing-client-and-RunOnServer branch May 6, 2026 11:07
@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
Signed-off-by: Simon Vacek <simonvacky@email.cz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/test-framework Test framework — infrastructure, Realm DSL, page objects, migration utils flaky-test team/cloud-native team/core-clients team/core-iam

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor and unify RunOnServer modules

3 participants

0