Make Vert.x test server Resource repeatable so the flaky-test retry works#5411
Merged
Merged
Conversation
…orks The three Vert.x test interpreters created the HTTP server eagerly, outside the Resource.make acquire, capturing a single server instance. The flaky-WS- test retry (TestSuite.retries, added in #5410) re-uses the test's server Resource, which re-runs listen() on that same instance; Vert.x 5's CleanableHttpServer.listen throws IllegalStateException when listen() is called twice on one server ("Starting server failed because of null"). So every retry of a Vert.x test failed instantly on server startup, defeating the retry. Create the server inside the acquire instead, so each acquire (and thus each retry) gets a fresh server. Add ServerResourceRepeatableSpec, which fails on the old eager code and passes now. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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.
Problem
The flaky-WebSocket-test retry added in #5410 (
TestSuite.retries) did not actually rescue the Vert.x WS flake. On CI the retry ran but every attempt after the first failed instantly with:Root cause
The three Vert.x test interpreters build the HTTP server eagerly, outside the
Resource.makeacquire:The retry re-runs the whole test, re-using the same server
Resource, which callslisten()a second time on the same server instance. Vert.x 5'sCleanableHttpServer.listenthrowsIllegalStateException(empty message → logged as "because of null") when itslistenContextis already set. So the per-test server Resource simply wasn't repeatable — the shared Vert.x was never actually broken.Fix
Create the server inside the acquire, so each acquire (and each retry) gets a fresh server:
Applied to
VertxTestServerInterpreter,CatsVertxTestServerInterpreter,ZioVertxTestServerInterpreter.Test
ServerResourceRepeatableSpecacquires the server Resource twice (what the retry does). It throws the exactIllegalStateExceptionon the old eager code and passes with this fix.🤖 Generated with Claude Code