8000 7FFF Fix flaky VerifyProfileTest#testCustomValidationLastName by ahus1 · Pull Request #55173 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Fix flaky VerifyProfileTest#testCustomValidationLastName - #55173

Draft
ahus1 wants to merge 1 commit into
keycloak:mainfrom
ahus1:is-55172-flaky-verify-profile-test
Draft

ahus1 wants to merge 1 commit into
keycloak:mainfrom
ahus1:is-55172-flaky-verify-profile-test

Conversation

@ahus1
@ahus1 ahus1 commented Nov 13, 2026
Copy link
Copy Markdown
Member

Closes #55172

The failure had two independent causes, so both are fixed here: the test submitted again before the first invalid submit had finished rendering, and the shared OAuth callback wait matched session_code= as if it were code=.

Decisions and assumptions

  • The wait in WaitUtils now matches whole parameter names (?, & or # followed by code= or error=). This changes behavior for all tests calling parseLoginResponse(), which I assume is intended, as the old match could only succeed early by accident.
  • The test waits for the last name validation error instead of adding a generic wait to assertCurrent(), to keep the change small. Other tests with an invalid-then-valid submit sequence may have the same race.
  • Verified locally with Firefox headless: about half of the runs failed before the change, and 8 of 8 passed after it. Chrome was not tested.
  • release/26.8 is the only supported branch with the migrated test and the faulty wait, so only that backport is needed.

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.

🟡 Changes recommended

The validation assertion can pass on the old page’s existing last-name error, so the test must wait for the submitted form to become stale to resolve the invalid-then-valid submission race.

1 open issue
What changed in this PR

This PR addresses the Firefox flakiness reported in #55172 by tightening synchronization in the profile-validation test and the shared OAuth callback wait.

Changes:

  • Adds a last-name validation-error assertion before resubmitting the profile form.
  • Matches complete code and error parameter names so session_code does not trigger the callback wait.
File Description
tests/​base/​src/​test/​java/​org/​keycloak/​tests/​forms/​VerifyProfileTest.java Checks for a validation error before the valid submission.
test-framework/​ui/​src/​main/​java/​org/​keycloak/​testframework/​ui/​webdriver/​WaitUtils.java Tightens OAuth callback parameter matching.

Review effort: Balanced


verifyProfilePage.assertCurrent();
// wait for the re-rendered page with the validation error before submitting again
assertNotNull(verifyProfilePage.getInputErrors().getLastNameError());
@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.actions.TermsAndConditionsTest#termsAccepted

Keycloak CI - Forms IT (firefox)

java.lang.RuntimeException: Could not create statement
	at org.jboss.arquillian.junit.Arquillian.methodBlock(Arquillian.java:307)
	at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:160)
	at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:344)
	at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:48)
...

Report flaky test

Closes keycloak#55172

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
@ahus1
ahus1 force-pushed the is-55172-flaky-verify-profile-test branch from 839b180 to e9a6c2b Compare November 13, 2026 17:45
@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.adapter.servlet.SAMLServletAdapterTest#employeeSigPostNoIdpKeyTestCertSubjectAsKeyNameInKeyInfo

Keycloak CI - Adapter IT

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

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: VerifyProfileTest#testCustomValidationLastName fails in Forms IT (firefox)

2 participants

0