Skip to content

nltest: split multi-part messages into smaller batches#269

Merged
nickgarlis merged 1 commit intomdlayher:mainfrom
nickgarlis:nltest
Mar 18, 2026
Merged

nltest: split multi-part messages into smaller batches#269
nickgarlis merged 1 commit intomdlayher:mainfrom
nickgarlis:nltest

Conversation

@nickgarlis
Copy link
Collaborator

The previous nltest implementation returned all multi-part messages except the Done message in a single Receive call. This made it difficult to verify that conn.Receive correctly loops over multiple Receive calls when draining multi-part responses.

This change splits multi-part messages into batches of (n+1)/2 where n is the number of remaining messages, requiring multiple Receive calls to drain the full response. It also adds TestConnReceiveMultipart to verify that all expected messages are received and that subsequent Receive calls return no messages after the response is fully drained.

The previous nltest implementation returned all multi-part messages
except the Done message in a single Receive call. This made it difficult
to verify that conn.Receive correctly loops over multiple Receive calls
when draining multi-part responses.

This change splits multi-part messages into batches of (n+1)/2 where n
is the number of remaining messages, requiring multiple Receive calls to
drain the full response. It also adds TestConnReceiveMultipart to verify
that all expected messages are received and that subsequent Receive
calls return no messages after the response is fully drained.
@nickgarlis nickgarlis merged commit ccabe8e into mdlayher:main Mar 18, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant