Improve runtime, reduce log output, and stabilize SSL failure assertions for SSLCertificateTest#1215
Improve runtime, reduce log output, and stabilize SSL failure assertions for SSLCertificateTest#1215Copilot wants to merge 26 commits into
SSLCertificateTest#1215Conversation
…rallelize no-exception checks Agent-Logs-Url: https://github.com/quickfix-j/quickfixj/sessions/f464dac4-ab03-4de1-a750-fbcb1d6bd19c Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
…rror messages Agent-Logs-Url: https://github.com/quickfix-j/quickfixj/sessions/f464dac4-ab03-4de1-a750-fbcb1d6bd19c Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
…Caught handler Agent-Logs-Url: https://github.com/quickfix-j/quickfixj/sessions/064bbb3a-a6bf-4600-bf29-db71d02c5845 Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
SSLCertificateTest
SSLCertificateTestSSLCertificateTest
Agent-Logs-Url: https://github.com/quickfix-j/quickfixj/sessions/d64730b5-aa97-44bd-9061-f58167740bad Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
Agent-Logs-Url: https://github.com/quickfix-j/quickfixj/sessions/84ec41ca-7a14-49eb-ae78-d83bfe444cf6 Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
Refactor createDefaults method to initialize defaults directly.
…lts() overload Agent-Logs-Url: https://github.com/quickfix-j/quickfixj/sessions/51422522-fc50-446b-a611-8461f3651a3e Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
SSLCertificateTestSSLCertificateTest
Agent-Logs-Url: https://github.com/quickfix-j/quickfixj/sessions/7e6f22d7-9852-4fa4-97a1-a398d3d572a3 Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
... Implemented for Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
SSLCertificateTestSSLCertificateTest
Agent-Logs-Url: https://github.com/quickfix-j/quickfixj/sessions/f0905c7d-0258-433c-be68-686a6ad569d1 Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@the-thing could you please take a look at this whenever you have the time. Thank you |
|
Sure. More AI slop. We are doomed... |
the-thing
left a comment
There was a problem hiding this comment.
Looks ok-ish. Did it improve running time and or differences across different operating systems?
| private final SessionConnector connector; | ||
| private final CountDownLatch exceptionThrownLatch; | ||
| private final AtomicReference<Throwable> exception; | ||
| private volatile boolean exceptionExpected = false; |
There was a problem hiding this comment.
This shouldn't be volatile. This should be final and set during construction time. Test case knows beforehand if the exception being thrown is required or not.
There was a problem hiding this comment.
Now when I look at this it looks that the flag is used only for logging. I have a feeling it shouldn't be here at all.
| String portLabel = getPortLabel(session); | ||
| int port = getPort(session); | ||
| if (exceptionExpected) { | ||
| LOGGER.info("{} {}={} exceptionCaught: {}", connectionType, portLabel, port, cause.getMessage()); |
There was a problem hiding this comment.
For logging, usually the static message comes first and then additional context arguments.
| SSLUtil.assertNotAuthenticated(connector, sessionID, authOn); | ||
| } | ||
|
|
||
| public void expectException() { |
There was a problem hiding this comment.
To be removed once the field is final.
| } | ||
|
|
||
| public void assertSslExceptionThrown(String expectedErrorMessage, Class<?> expectedErrorType) throws Exception { | ||
| exceptionExpected = true; |
| initiator.assertSslExceptionThrown(); | ||
| // Depending on JSSE/provider timing, initiator may fail before surfacing an SSL exception. | ||
| try { | ||
| initiator.assertSslExceptionThrown(); |
There was a problem hiding this comment.
Ok I see what it's doing. When exception is expected but it is not thrown it switches to validate if logon was sent - seems reasonable.
Probably this should be abstracted into a separate asset method e.g. "assertSslExceptionThrownOrLogonNotSent" etc.
Hi @the-thing , IMHO it's not slop as long as someone asked for it. :) I created an issue here #1214 to improve things.
Complete CI job time is down from about 45 mins to about 30 mins. I did not yet count how many lines of log file less. |
|
No problem. Take it with a pinch of salt. I use AI myself occasionally, but I think it is being used too much.
That is really good. |
|
@copilot please integrate proposed review changes by the-thing |
Agent-Logs-Url: https://github.com/quickfix-j/quickfixj/sessions/74ec0d16-c569-477a-80ff-9996ad4af00e Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
Agent-Logs-Url: https://github.com/quickfix-j/quickfixj/sessions/74ec0d16-c569-477a-80ff-9996ad4af00e Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
Integrated the proposed review changes from @the-thing in Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
SSLCertificateTestwas consuming ~20 of the CI job's ~45 minutes, logging ~45k of ~120k log lines. This PR now includes six targeted fixes:Timeout and heartbeat tuning
TIMEOUT_SECONDS: 15s → 7sHeartBtInt: 30s → 5s across all session settings builders — a heartbeat exchange within the window is sufficient to confirm a healthy sessionReconnect interval cleanup
Initiator.SETTING_RECONNECT_INTERVALoverrides in this test class so the default 30 second reconnect interval is usedReduce log noise for expected failures
exceptionExpectedis now configured at connector construction time and stored as an immutable (final) field onTestConnectorexpectException()path;shouldFailWhen*tests now construct relevant connectors withexceptionExpected=truebeforestart()assertSslExceptionThrown(...)prepareConnectorlogs message-only when exceptions are expected, and full stack trace otherwiseinitiator/acceptorandconnectPort/acceptPort)exceptionCaught ...), and expected-path logs are explicitly marked (exceptionCaught (expected) ...)This cuts the bulk of log output generated by
shouldFailWhen*tests while making the remaining output easier to attribute.Parallel no-exception checks
Added
assertNoSslExceptionsThrown(TestConnector... connectors)— runs each connector's latch-wait concurrently instead of sequentially. For a test with N connectors this replaces N×7s with a single 7s wait.Threads are named (
ssl-check<Type><index>) for debuggability. On failure, a composite error message summarises all failures upfront with individual errors as suppressed exceptions. Applied across 15 test methods.Test name logging
Added a class-level
LOGGERand a@Rule TestNamefield toSSLCertificateTest. The existing@Before setUp()now logs>>> Running test: <methodName>before every test, making it easy to correlate log output with the active test method in CI logs.Targeted flakiness stabilization for
shouldFailWhenUsingEmptyServerKeyStore()TestInitiatorviatoAdmin(...)(MsgType.LOGON) to support this check.assertSslExceptionThrownOrLogonNotSent(...)) for clarity.This stabilizes the test across JSSE/provider/timing differences while preserving intended behavior.