8000 Migrate organization member package to the new testsuite by vramik · Pull Request #50672 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Migrate organization member package to the new testsuite - #50672

Merged
ahus1 merged 1 commit into
keycloak:mainfrom
vramik:48184-migrate-oeg-member-tests
Jul 14, 2026
Merged

ahus1 merged 1 commit into
keycloak:mainfrom
vramik:48184-migrate-oeg-member-tests

Conversation

@vramik
@vramik vramik commented Jul 7, 2026
Copy link
Copy Markdown
Contributor

Closes #48184

@vramik
vramik force-pushed the 48184-migrate-oeg-member-tests branch from af8ea9a to 0e6b945 Compare July 7, 2026 19:32
@vramik
vramik marked this pull request as ready for review July 8, 2026 07:24
@vramik
vramik requested review from a team as code owners July 8, 2026 07:24
Copilot AI review requested due to automatic review settings July 8, 2026 07:24
@vramik
vramik requested review from a team as code owners July 8, 2026 07:24
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

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 OrganizationMemberTest into the new test framework (injection-based realms/users, UI login flow helpers, run-on-server usage).
  • Consolidates/shared org-broker setup logic into AbstractOrganizationTest and 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 the managedRealm parameter. This can leave organizations behind in non-default realms. Use managedRealm.cleanup() here.
        String orgId = id;
        realm.cleanup().add(r -> {
            try {
                r.organizations().get(orgId).delete().close();
            } catch (NotFoundException ignored) {}
        });

Copilot AI review requested due to automatic review settings July 8, 2026 08:04
@vramik
vramik force-pushed the 48184-migrate-oeg-member-tests branch from 0e6b945 to 96e52e1 Compare July 8, 2026 08:04
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 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.

Copilot AI review requested due to automatic review settings July 8, 2026 08:24
@vramik
vramik force-pushed the 48184-migrate-oeg-member-tests branch from 96e52e1 to 9b609ed Compare July 8, 2026 08:24
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 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.

Copilot AI review requested due to automatic review settings July 10, 2026 08:43
@vramik
vramik force-pushed the 48184-migrate-oeg-member-tests branch from 9b609ed to f06f097 Compare July 10, 2026 08:43
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 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 AliceUserConf supplies username, email, first name, and last name. The default IdpReviewProfileAuthenticator mode only shows that page when mandatory profile data is missing, so the first org-A login completes directly and loginUpdateProfilePage.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>
Copilot AI review requested due to automatic review settings July 10, 2026 09:06
@vramik
vramik force-pushed the 48184-migrate-oeg-member-tests branch from f06f097 to e2e9967 Compare July 10, 2026 09:06
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 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.testsuite framework, JUnit 4, and LDAPRule. Issue #48184 requests migration of the tests from the old organization/member directory 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 realm has class lifecycle, so this direct user-profile update survives the test. Unlike the temporary configuration in testUserProfileAttributePermissions, 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 loginViaBroker does. 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 to realm.cleanup().

@ahus1
ahus1 merged commit 69d75a0 into keycloak:main Jul 14, 2026
91 checks passed
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.

Migrate Organization Member tests into new testsuite

5 participants

0