Repository navigation
test: retry requests refused while a TCP endpoint comes online - #218
Merged
Merged
Conversation
The online tests send requests to an endpoint right after creating it. An HTTP endpoint that ngrok has not routed yet answers 404, which retry-config.mjs retries. A TCP endpoint refuses the connection instead, and the retry condition gave up on any error without a response, so a test that requested its TCP endpoint too soon failed with ECONNREFUSED, as "listen and forward multipass" did on one CI run while passing on another of the same code. Retry a refused connection with the same delays. A new test refuses the first connection and listens from then on, and checks the config retries until it gets the answer.
wesnel
marked this pull request as ready for review
November 12, 2026 00:02
wesnel
requested review from
andrew-harris-at-ngrok,
grant-higgins-0,
joshbottelberghe,
kevin-ngrok and
sajethm
November 12, 2026 00:02
This was referenced Nov 13, 2026
Merged
andrew-harris-at-ngrok
approved these changes
Nov 13, 2026
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.
The online tests request each endpoint right after creating it, so they retry while ngrok brings it online. Until now they retried only a 404 or 5xx response. An HTTP endpoint that isn't live yet answers 404, so it was retried. A TCP endpoint refuses the connection instead, and a refused connection has no response, so the request failed straight away. That's what happened to "listen and forward multipass" in a #215 CI run (
connect ECONNREFUSEDto its TCP endpoint), while the same code passed in another run.retry-config.mjsnow also retries a refused connection, with the same delays. Every test that makes requests uses this one config.Validation
retry-config.spec.mjs, refuses the first connection and then starts listening. It checks that the config retries until it gets the answer. Before the fix it failed withconnect ECONNREFUSEDand no retry, the same error as the CI failure. After the fix it passed three runs out of three.Weak spots, assumptions and decisions
Reverting
Two-way door. Only test code changes. Reverting brings back the occasional failure.