feat(registry): Make graceful shutdown test robust #4719
Closed
+0
−0
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.
Description
Fixes the
TestGracefulShutdown
test that has been failing with Go 1.25.Closes #4696
Problem
The test was failing with
unexpected EOF
when run with Go 1.25. The root cause was that the test attempted to send an incomplete HTTP request by splitting the request line into two separate writes:This approach has several issues:
Invalid HTTP protocol: The request line
"GET /v2/ "
is incomplete - it's missing the required HTTP version and CRLF terminator. A valid HTTP/1.1 request line must follow the format:METHOD SP REQUEST-URI SP HTTP-VERSION CRLF
Undefined behavior: The server cannot distinguish between:
Go 1.25 stricter behavior: Go 1.25 improved graceful shutdown to immediately close connections with incomplete or invalid requests, rather than waiting indefinitely for them to complete.
Solution
Updated the test to send a complete, valid HTTP/1.1 request before triggering graceful shutdown:
This properly tests graceful shutdown behavior:
Changes Made
defer conn.Close()
for proper resource cleanupdefer conn2.Close()
when second connection test failserrchan := make(chan error, 1)
)