8000 Migrate AuthAttachmentRegisterTest by vaceksimon · Pull Request #52032 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Migrate AuthAttachmentRegisterTest - #52032

Merged
rmartinc merged 2 commits into
keycloak:mainfrom
vaceksimon:51512-AuthAttachmentRegisterTest
Aug 28, 2026
Merged

rmartinc merged 2 commits into
keycloak:mainfrom
vaceksimon:51512-AuthAttachmentRegisterTest

Conversation

@vaceksimon
@vaceksimon vaceksimon commented Aug 25, 2026 •
Copy link
Copy Markdown
Contributor

Also removes a default user from the superclass' realm configuration, as it is removed anyway by most test methods

Copilot AI balanced review requested due to automatic review settings August 25, 2026 12:50
@vaceksimon
vaceksimon requested review from a team as code owners August 25, 2026 12:50
@vaceksimon
vaceksimon force-pushed the 51512-AuthAttachmentRegisterTest branch from ef6686a to d51cee7 Compare August 25, 2026 12:55
Copilot AI 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.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Migrates WebAuthn “other settings”/attachment registration tests to the newer test framework structure and adjusts user lifecycle handling during registration flows.

Changes:

  • Moved AuthAttachmentRegisterTest from the legacy Arquillian testsuite into tests/webauthn and updated it to the new integration test style.
  • Removed the pre-created default user from the realm configuration and replaced ad-hoc deletions with cleanup hooks.
  • Updated several WebAuthn registration tests to explicitly schedule user cleanup when stopping mid-registration.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/webauthn/registration/AuthAttachmentRegisterTest.java Removes the legacy Arquillian-based attachment registration test (now migrated to tests/webauthn).
tests/webauthn/src/test/java/org/keycloak/tests/webauthn/registration/WebAuthnOtherSettingsTest.java Replaces “delete default user” pattern with per-test cleanup hooks during partial registration flows.
tests/webauthn/src/test/java/org/keycloak/tests/webauthn/registration/AuthAttachmentRegisterTest.java Adds the migrated attachment registration tests using the new integration test base/annotations.
tests/webauthn/src/test/java/org/keycloak/tests/webauthn/AbstractWebAuthnVirtualTest.java Adds automatic cleanup for users created during registration and removes the pre-created default user from realm setup.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI review requested due to automatic review settings August 25, 2026 13:07
Copilot AI 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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Copilot AI review requested due to automatic review settings August 25, 2026 15:38
@vaceksimon
vaceksimon force-pushed the 51512-AuthAttachmentRegisterTest branch from d51cee7 to 877b65e Compare August 25, 2026 15:38
Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Signed-off-by: Simon Vacek <vaceksimon-github@pm.me>
Closes: keycloak#51512

Signed-off-by: Simon Vacek <vaceksimon-github@pm.me>
Copilot AI review requested due to automatic review settings August 26, 2026 08:52
@vaceksimon
vaceksimon force-pushed the 51512-AuthAttachmentRegisterTest branch from 877b65e to a3ecbdd Compare August 26, 2026 08:52
Copilot AI 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.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

Suppressed comments (1)

tests/webauthn/src/test/java/org/keycloak/tests/webauthn/registration/AuthAttachmentRegisterTest.java:41

  • This comment does not preserve the removed @IgnoreBrowserDriver(FirefoxDriver.class) behavior, so Firefox runs now execute this class (and its inherited passwordless tests) despite the known incompatibility in #10368. Add an enforceable JUnit 5 condition or assumption that skips these tests for BrowserType.FIREFOX.
// This test should be ignored on Firefox: See https://github.com/keycloak/keycloak/issues/10368

@keycloak-github-bot keycloak-github-bot Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@keycloak-github-bot
Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.webauthn.WebAuthnPropertyTest#timeout

Keycloak CI - WebAuthn IT

org.openqa.selenium.WebDriverException: 
unknown error: unhandled inspector error: {"code":-32000,"message":"Node with given id does not belong to the document"}
  (Session info: chrome=151.0.7922.137)
Build info: version: '4.46.0', revision: 'df5a634 df5a6341cbb5f8f06b836bd595752775627c80dc'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.17.0-1022-azure', java.version: '25.0.4'
...

Report flaky test

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

@vaceksimon LGTM, just few small things. Thanks!

* @author <a href="mailto:mabartos@redhat.com">Martin Bartos</a>
*/
@IgnoreBrowserDriver(FirefoxDriver.class) // See https://github.com/keycloak/keycloak/issues/10368
// This test should be ignored on Firefox: See https://github.com/keycloak/keycloak/issues/10368
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.

As mentioned offline, we don't need to specify the Firefox issue.

public void authenticatorAttachmentPlatform() {
managedRealm.updateWithCleanup(r -> {
if (isPasswordless()) {
r.webAuthnPolicyPasswordlessAuthenticatorAttachment(AuthenticatorAttachment.PLATFORM.getValue());
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.

It seems that the getWebAuthnRealmUpdater in its current form will not have a future in the new testsuite.

But IMO it's very useful here as we need to check the normal webauthn, and passwordless one.

Would it be possible to update the realm updater for webauthn that would accept the realm? Otherwise, we'll have so many duplications like this:

if (isPasswordless()) {
            assertEquals(AuthenticatorAttachment.PLATFORM.getValue(), rep.getWebAuthnPolicyPasswordlessAuthenticatorAttachment());
            assertEquals(UserVerificationRequirement.DISCOURAGED.getValue(), rep.getWebAuthnPolicyPasswordlessUserVerificationRequirement());
        } else {
            assertEquals(AuthenticatorAttachment.PLATFORM.getValue(), rep.getWebAuthnPolicyAuthenticatorAttachment());
            assertEquals(UserVerificationRequirement.DISCOURAGED.getValue(), rep.getWebAuthnPolicyUserVerificationRequirement());
        }

WDYT?

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.

Definitely right. ServerResourceUpdater and other classes are not moved, but AbstractWebAuthnRealmUpdater and its subclasses are definitely beneficial for reducing boilerplate.

I will create a follow-up PR to create the WebAuthn realm updater, which can be used with RealmBuilder and in the configs too. And I will update the WebAuthn test classes that will benefit from it.

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.

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.

Ok, thanks!

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

Thanks @vaceksimon! LGTM in general if you perform the little changes suggested by @mabartos. If you are going to do one of the suggestions in a follow-up you can forget about that one. Thanks!

@vaceksimon
vaceksimon commented Aug 27, 2026 •
Copy link
Copy Markdown
Contributor Author

Hey @rmartinc, if it's okay, I'd tackle both of the suggestions at once in a follow-up PR for:

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

@vaceksimon LGTM. I'm ok with the follow-ups. Thanks!

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

Okis @vaceksimon! Approved then! And thanks @mabartos for the review!

@rmartinc
rmartinc merged commit 96fef56 into keycloak:main Aug 28, 2026
94 checks passed
@vaceksimon
vaceksimon deleted the 51512-AuthAttachmentRegisterTest branch August 31, 2026 16:02
@vaceksimon vaceksimon changed the title Migrate WebAuthnOtherSettingsTest Migrate AuthAttachmentRegisterTest Sep 1, 2026
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.

Flaky test: org.keycloak.testsuite.webauthn.registration.AuthAttachmentRegisterTest#authenticatorAttachmentPlatform

4 participants

0