Repository navigation
Migrate AuthAttachmentRegisterTest - #52032
Conversation
ef6686a to
d51cee7
Compare
There was a problem hiding this comment.
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
AuthAttachmentRegisterTestfrom the legacy Arquillian testsuite intotests/webauthnand 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.
d51cee7 to
877b65e
Compare
Signed-off-by: Simon Vacek <vaceksimon-github@pm.me>
Closes: keycloak#51512 Signed-off-by: Simon Vacek <vaceksimon-github@pm.me>
877b65e to
a3ecbdd
Compare
There was a problem hiding this comment.
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 forBrowserType.FIREFOX.
// This test should be ignored on Firefox: See https://github.com/keycloak/keycloak/issues/10368
Unreported flaky test detectedIf 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 |
There was a problem hiding this comment.
@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 |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
There was a problem hiding this comment.
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!
|
Hey @rmartinc, if it's okay, I'd tackle both of the suggestions at once in a follow-up PR for: |
There was a problem hiding this comment.
@vaceksimon LGTM. I'm ok with the follow-ups. Thanks!
There was a problem hiding this comment.
Okis @vaceksimon! Approved then! And thanks @mabartos for the review!
Also removes a default user from the superclass' realm configuration, as it is removed anyway by most test methods