Repository navigation
Migrate organization member package to the new testsuite - #50672
Conversation
af8ea9a to
0e6b945
Compare
There was a problem hiding this comment.
Pull request overview
This PR migrates Organization Member-related tests from the legacy testsuite layout to the newer testframework-based tests in tests/base, aligning organization member coverage with the new integration test approach.
Changes:
- Migrates
OrganizationMemberTestinto the new test framework (injection-based realms/users, UI login flow helpers, run-on-server usage). - Consolidates/shared org-broker setup logic into
AbstractOrganizationTestand updates dependent tests accordingly. - Adds small test-framework utilities needed by migrated tests (
ManagedUser.getEmail(),LoginPage.isPasswordInputPresent()), and adjusts package placement for an LDAP federation test.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/organization/federation/OrganizationMemberWithLdapTest.java | Fixes package to match its directory/package structure under organization.federation. |
| tests/base/src/test/java/org/keycloak/tests/organization/member/OrganizationMemberTest.java | Migrated organization member test suite to the new testframework with UI-driven broker login helpers and s
10000
erver-side execution. |
| tests/base/src/test/java/org/keycloak/tests/organization/member/OrganizationMemberIdpLinkTest.java | Moves test into correct package and reuses shared broker setup/constants from AbstractOrganizationTest. |
| tests/base/src/test/java/org/keycloak/tests/organization/admin/OrganizationTest.java | Updates usage to new createOrganization(ManagedRealm, ...) and avoids the removed helper signature. |
| tests/base/src/test/java/org/keycloak/tests/organization/admin/OrganizationMemberTest.java | Removes old admin-package test now covered by the migrated suite. |
| tests/base/src/test/java/org/keycloak/tests/organization/admin/AbstractOrganizationTest.java | Refactors createOrganization to accept ManagedRealm and adds shared org-broker setup/constants. |
| test-framework/ui/src/main/java/org/keycloak/testframework/ui/page/LoginPage.java | Adds isPasswordInputPresent() utility for login-flow assertions. |
| test-framework/core/src/main/java/org/keycloak/testframework/realm/ManagedUser.java | Adds getEmail() to expose the created user’s email to tests. |
Comments suppressed due to low confidence (1)
tests/base/src/test/java/org/keycloak/tests/organization/admin/AbstractOrganizationTest.java:123
- Same issue as above: organization deletion cleanup is added to
realm.cleanup()even when the organization was created in themanagedRealmparameter. This can leave organizations behind in non-default realms. UsemanagedRealm.cleanup()here.
String orgId = id;
realm.cleanup().add(r -> {
try {
r.organizations().get(orgId).delete().close();
} catch (NotFoundException ignored) {}
});
0e6b945 to
96e52e1
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
tests/base/src/test/java/org/keycloak/tests/organization/member/OrganizationMemberTest.java:203
- This test updates the realm user-profile configuration (unmanagedAttributePolicy) but never restores the original configuration. That can leak state across tests and cause ordering-dependent failures.
tests/base/src/test/java/org/keycloak/tests/organization/member/OrganizationMemberTest.java:404 - testDeleteUnmanagedMember() sets UnmanagedAttributePolicy to ENABLED but never applies it via userProfile().update(...), so the configuration change is ineffective. If this policy is required for the test scenario, it should be updated (and restored) to avoid leaking state.
96e52e1 to
9b609ed
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (3)
tests/base/src/test/java/org/keycloak/tests/organization/admin/AbstractOrganizationTest.java:123
- In createOrganization(ManagedRealm,...), the organization cleanup is registered on the field 'realm' instead of the 'managedRealm' parameter. When callers pass a different realm (e.g., secondRealm), the organization deletion will be registered on the wrong cleanup and can leak organizations across tests.
String orgId = id;
realm.cleanup().add(r -> {
try {
r.organizations().get(orgId).delete().close();
} catch (NotFoundException ignored) {}
});
tests/base/src/test/java/org/keycloak/tests/organization/member/OrganizationMemberTest.java:945
- loginViaBroker() submits the provider login (and optionally update-profile) and immediately searches the admin API for the federated user. Without waiting for the OAuth callback redirect, this can race and make the test flaky. Other tests in the new framework explicitly wait for the callback (e.g., tests/base/src/test/java/org/keycloak/tests/forms/SSOTest.java:121-123).
tests/base/src/test/java/org/keycloak/tests/organization/member/OrganizationMemberTest.java:967 - loginViaNonOrgIdP() returns immediately after submitting the provider login without waiting for the OAuth callback/redirect back to the consumer realm. This can race with the subsequent user search and lead to intermittent failures.
9b609ed to
f06f097
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
tests/base/src/test/java/org/keycloak/tests/organization/member/OrganizationMemberTest.java:943
- This branch assumes the broker flow is displaying the update-profile page, but
AliceUserConfsupplies username, email, first name, and last name. The defaultIdpReviewProfileAuthenticatormode only shows that page when mandatory profile data is missing, so the first org-A login completes directly andloginUpdateProfilePage.update(...)operates on the wrong page. Configure this login to require profile review (or create the provider user with missing required data) before attempting to update the email.
Closes keycloak#48184 Signed-off-by: vramik <vramik@redhat.com>
f06f097 to
e2e9967
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (4)
testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/organization/federation/OrganizationMemberWithLdapTest.java:18
- This change only moves the LDAP member test to another package in the legacy Arquillian suite; the class still uses the old
org.keycloak.testsuiteframework, JUnit 4, andLDAPRule. Issue #48184 requests migration of the tests from the oldorganization/memberdirectory to the new framework, so closing it with this test merely relocated leaves that requirement incomplete. Port this test to the new testsuite or document an explicit scope exception.
tests/base/src/test/java/org/keycloak/tests/organization/member/OrganizationMemberTest.java:202 - The inherited
realmhas class lifecycle, so this direct user-profile update survives the test. Unlike the temporary configuration intestUserProfileAttributePermissions, it is never restored, making later tests run with unmanaged attributes enabled and their results order-dependent. Register restoration with the managed-realm cleanup before updating it.
tests/base/src/test/java/org/keycloak/tests/organization/member/OrganizationMemberTest.java:881 - This updates the class-scoped realm's user-profile configuration without registering cleanup, so unmanaged attributes remain enabled for whichever tests execute afterward. Preserve and restore the original configuration through
realm.cleanup()to keep the migrated tests isolated.
tests/base/src/test/java/org/keycloak/tests/organization/member/OrganizationMemberTest.java:655 - The broker login creates a user in the class-scoped consumer realm, but this path does not register user cleanup as
loginViaBrokerdoes. The user therefore remains after the IdP and organization are removed and can interfere with later broker tests for the same provider account. Add the created user torealm.cleanup().
Closes #48184