fix(cassandra-embedded): increase CQL request timeout to 20s in ServerTest#973
Draft
fix(cassandra-embedded): increase CQL request timeout to 20s in ServerTest#973
Conversation
…ent flaky test failures Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenAM/sessions/1d610662-c74b-4a31-bb7f-6eb2e1331826 Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix CQL request timeout for embedded Cassandra tests
fix(cassandra-embedded): increase CQL request timeout to 20s in ServerTest
Mar 27, 2026
….java Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenAM/sessions/648f033b-537c-4f53-b47f-afc8596ff662 Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
System.setProperty("datastax-java-driver.basic.request.timeout", "20 seconds")toServerTest.init()to increase the DataStax Java driver timeout from the default 2s to 20sServerTest.javato addPortions Copyright 2020-2026 3A Systems, LLCOriginal prompt
Problem
The CI build fails in the
openam-cassandra-embeddedmodule with:The DataStax Java driver default request timeout is 2 seconds (
PT2S), which is too short for an embedded Cassandra instance that has just started. This causes a flaky/systematic test failure inServerTest.start_test.Fix
In
openam-cassandra/openam-cassandra-embedded/src/test/java/ServerTest.java, add the following system property in the@BeforeClassinit()method to increase the CQL request timeout to 20 seconds for tests:Full updated
init()method:File to modify
openam-cassandra/openam-cassandra-embedded/src/test/java/ServerTest.javaNo other files need to be changed.
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant: Let me fetch the job logs to analyze the failure.
Assistant: ## Root Cause
The job fails in the
openam-cassandra-embeddedmodule with:This originates at
Server.java:109— the CQL import loop catches an exception (a query timeout,PT2S= 2 second timeout) and firesassert false, which becomes a hardAssertionErrorat runtime because the JVM is running with assertions enabled (-ea).The embedded Cassandra node isn't fully ready to serve queries by the time the CQL import runs, causing a
QueryExecutionException/ timeout.Solution
There are two complementary fixes:
1. Add a retry loop around CQL execution (primary fix)
Instead of immediately failing on a timeout, retry transient errors for a bounded period. Replace the
catchblock inside the import loop (lines 104–110) with a retry:Apply this same pattern to both the main import block (lines 102–113) and the test import block (lines 122–133).
2. Add a readiness wait after Cassandra activation (secondary fix)
After
cassandraDaemon.activate()(line 75), add a brief readiness probe before proceeding to the CQL import. The existing superuser wait loop (lines 85–94) only runs when auth is configured ascassandra. Make it unconditional:3. Consider increasing the driver timeout (optional)
The default
PT2S(2 second) request timeout from the DataStax driver is very tight for an embedded instance that just started. You can increase it via system property orapplication.conf:Or set it programmatically before the session is built: