tests: start on de-duplicating stream API tests. #1306
Merged
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.
This branch is a follow-up from #1299 and tries to remove some duplication in the API tests related to the
Stream
andStreamOwned
types. It doesn't get 100% of the way there, but I think represents an improvement over the status quo.We want coverage for reading/writing for both the owned and reference types. We also want coverage for reading unexpected EOF errors, and for reading with and without the
read_buf
feature. This branch is able to remove most of the duplication for testing these scenarios, but still leaves some for the server and client contexts.The most obvious next step is to try and combine
test_client_stream_read
andtest_server_stream_read
as well astest_client_stream_write
andtest_server_stream_write
- in practice these sets of functions are identical except for which side of the connection is used where. I started down this road in e248816 but ran into challenges finding a way to represent thepipe
in a way that would allow the usage scenarios we have in mind and wouldn't run into lifetime issues. I've spent an unfortunate amount of time trying to figure out a path forward but have to admit defeat to switch to other tasks. I figured the cleanup I have is worthwhile as-is, and hopefully by sharing my progress someone else might be able to spot an approach for the last bit that I missed :-)