8000 Migrate the SSOTest by msdaly200 · Pull Request #48367 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Migrate the SSOTest - #48367

Merged
ahus1 merged 3 commits into
keycloak:mainfrom
msdaly200:48153
Apr 29, 2026
Merged

ahus1 merged 3 commits into
keycloak:mainfrom
msdaly200:48153

Conversation

@msdaly200
Copy link
Copy Markdown
Contributor

Closes #48153

Migrate the SSOTest

@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.model.singleUseObject.SingleUseObjectModelTest#testCluster

Keycloak CI - Store Model Tests

java.lang.AssertionError: 
threads didn't terminate in time: [main (RUNNABLE):
	at java.management@25.0.2/sun.management.ThreadImpl.dumpThreads0(Native Method)
	at java.management@25.0.2/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:505)
	at java.management@25.0.2/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:493)
...

Report flaky test

org.keycloak.testsuite.model.user.UserModelTest#testAddRemoveUserConcurrent

Keycloak CI - Store Model Tests

java.lang.NullPointerException: Cannot invoke "org.keycloak.models.KeycloakSessionFactory.create()" because "factory" is null
	at org.keycloak.models.utils.KeycloakModelUtils.runJobInTransactionWithResult(KeycloakModelUtils.java:463)
	at org.keycloak.models.utils.KeycloakModelUtils.runJobInTransactionWithResult(KeycloakModelUtils.java:447)
	at org.keycloak.testsuite.model.KeycloakModelTest.inComittedTransaction(KeycloakModelTest.java:590)
	at org.keycloak.testsuite.model.KeycloakModelTest.inComittedTransaction(KeycloakModelTest.java:578)
...

Report flaky test

@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

@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 @msdaly200! Please remove the old test, this way we can check the differences. Review is difficult without differences. 😄

Remember that, when you move a database test, you need to add the annotation @DatabaseTest to the test. You can also add to specific tests if you don't want all the class to be executed in the database flow, this way only a the annotated tests will be there. Your test should be also executed in the DB jobs (postgresql, mariadb, oracle,...).

@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.authz.PolicyEvaluationTest#

Keycloak CI - Base IT (3)

org.opentest4j.AssertionFailedError: expected: <PERMIT> but was: <null>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
...
org.opentest4j.AssertionFailedError: expected: <PERMIT> but was: <null>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
...
org.opentest4j.AssertionFailedError: expected: <PERMIT> but was: <null>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
...

Report flaky test

@vaceksimon vaceksimon 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 is a pretty big PR with lots of changes. Please next time try to reduce the AI generated noise, at least for the comments. Thank you for the contribution @msdaly200

@msdaly200
Copy link
Copy Markdown
Contributor Author

Thanks @vaceksimon and @rmartinc for all your comments, much appreciated.

@msdaly200
Copy link
Copy Markdown
Contributor Author

@vaceksimon @rmartinc Assuming testsuite/integration-arquillian/tests/base/testsuites/database-suite needs updated too...ie ssotest removed?

@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.adapter.servlet.SAMLServletAdapterTest#salesPostEmptyConsumerPostURL

Keycloak CI - Adapter IT Strict Cookies

org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
...

Report flaky test

org.keycloak.testsuite.adapter.servlet.SAMLServletAdapterTest#salesPostSigTest

Keycloak CI - Adapter IT Strict Cookies

org.awaitility.core.ConditionTimeoutException: Assertion condition defined as a Lambda expression in org.keycloak.testsuite.util.URLAssert URL expected to begin with: https://localhost:8543/auth/realms/demo/login-action ; actual URL: https://localhost:8643/sales-post-sig/ ==> expected: <true> but was: <false> within 10 seconds.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.AssertionCondition.await(AssertionCondition.java:119)
	at org.awaitility.core.AssertionCondition.await(AssertionCondition.java:31)
	at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:1160)
...

Report flaky test

org.keycloak.testsuite.adapter.servlet.SAMLServletAdapterTest#disabledClientTest

Keycloak CI - Adapter IT Strict Cookies

org.openqa.selenium.TimeoutException: 
Expected condition failed: waiting for wrapped: text ('Login requester not enabled') to be present in text in element found by By.xpath: //body (tried for 5 second(s) with 500 milliseconds interval)
Build info: version: '4.28.1', revision: '73f5ad48a2'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.17.0-1010-azure', java.version: '21.0.10'
Driver info: org.openqa.selenium.firefox.FirefoxDriver_ByGraphene
...

Report flaky test

@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

@msdaly200
msdaly200 force-pushed the 48153 branch 3 times, most recently from 089fa01 to 01936a0 Compare April 28, 2026 07:35
@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 @msdaly200! Just three minor things and I think that this is OK. Let's see if we don't forget to remove/add the test somewhere. 😄

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

Found a few more things. I think we'll be finished with the next one. Thanks @msdaly200

Comment on lines +284 to +305
// Poll both password update events (order may vary due to identical timestamps)
EventRepresentation event1 = events.poll();
EventRepresentation event2 = events.poll();

EventRepresentation updatePasswordEvent;
EventRepresentation updateCredentialEvent;

if (EventType.UPDATE_PASSWORD == EventType.valueOf(event1.getType())) {
updatePasswordEvent = event1;
updateCredentialEvent = event2;
} else {
updatePasswordEvent = event2;
updateCredentialEvent = event1;
}

EventAssertion.assertSuccess(updatePasswordEvent)
.type(EventType.UPDATE_PASSWORD)
.details(Details.CREDENTIAL_TYPE, PasswordCredentialModel.TYPE);

EventAssertion.assertSuccess(updateCredentialEvent)
.type(EventType.UPDATE_CREDENTIAL)
.details(Details.CREDENTIAL_TYPE, PasswordCredentialModel.TYPE);
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.

I think what the comment states is wrong

// Poll both password update events (order may vary due to identical timestamps)

Perhaps adding the driver.waiting().waitForOAuthCallback() call solved the issue. I tried running this version and the events were asserted in the correct order each time.

Suggested change
// Poll both password update events (order may vary due to identical timestamps)
EventRepresentation event1 = events.poll();
EventRepresentation event2 = events.poll();
EventRepresentation updatePasswordEvent;
EventRepresentation updateCredentialEvent;
if (EventType.UPDATE_PASSWORD == EventType.valueOf(event1.getType())) {
updatePasswordEvent = event1;
updateCredentialEvent = event2;
} else {
updatePasswordEvent = event2;
updateCredentialEvent = event1;
}
EventAssertion.assertSuccess(updatePasswordEvent)
.type(EventType.UPDATE_PASSWORD)
.details(Details.CREDENTIAL_TYPE, PasswordCredentialModel.TYPE);
EventAssertion.assertSuccess(updateCredentialEvent)
.type(EventType.UPDATE_CREDENTIAL)
.details(Details.CREDENTIAL_TYPE, PasswordCredentialModel.TYPE);
EventAssertion.assertSuccess(events.poll())
.type(EventType.UPDATE_PASSWORD)
.details(Details.CREDENTIAL_TYPE, PasswordCredentialModel.TYPE);
EventAssertion.assertSuccess(events.poll())
.type(EventType.UPDATE_CREDENTIAL)
.details(Details.CREDENTIAL_TYPE, PasswordCredentialModel.TYPE);

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.

Thanks Simon for all the comments - I added this because it was failing for the MySQL build, so locally this works fine - events always come back in the expected way, but not for MySQL.

@msdaly200
msdaly200 force-pushed the 48153 branch 3 times, most recently from 6cd0845 to 1da5ea6 Compare April 29, 2026 09:26
Signed-off-by: Marie Daly <marie.daly1@ibm.com>
Signed-off-by: Marie Daly <marie.daly1@ibm.com>
Signed-off-by: Marie Daly <marie.daly1@ibm.com>
@msdaly200
Copy link
Copy Markdown
Contributor Author

Hi @vaceksimon and @rmartinc again thanks for your hard work in reviewing this file. I added more commits again, from a different branch in an attempt to keep git history. So the main code hasn't changed. Can you review/approve when you get a chance?

@vaceksimon vaceksimon 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 for the great work @msdaly200!

@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 a lot @msdaly200! LGTM too!

@ahus1
ahus1 merged commit 9f2ea27 into keycloak:main Apr 29, 2026
85 checks passed
@msdaly200
msdaly200 deleted the 48153 branch April 30, 2026 10:08
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 the SSOTest

4 participants

0