8000 tests: start on de-duplicating stream API tests. by cpu · Pull Request #1306 · rustls/rustls · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tests: start on de-duplicating stream API tests. #1306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2023

Conversation

cpu
Copy link
Member
@cpu cpu commented May 24, 2023

This branch is a follow-up from #1299 and tries to remove some duplication in the API tests related to the Stream and StreamOwned 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 and test_server_stream_read as well as test_client_stream_write and test_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 the pipe 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 :-)

@cpu cpu self-assigned this May 24, 2023
@codecov
Copy link
codecov bot commented May 24, 2023

Codecov Report

Merging #1306 (069359a) into main (f40aacf) will decrease coverage by 0.03%.
The diff coverage is n/a.

❗ Current head 069359a differs from pull request most recent head 237b333. Consider uploading reports for the commit 237b333 to get more accurate results

@@            Coverage Diff             @@
##             main    #1306      +/-   ##
==========================================
- Coverage   95.81%   95.78%   -0.03%     
==========================================
  Files          60       60              
  Lines       14454    14342     -112     
==========================================
- Hits        13849    13738     -111     
+ Misses        605      604       -1     

see 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member
@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer to standardize on moving helper functions below the relevant tests instead of above them, but this definitely looks like a nice improvement!

This commit tries to remove some duplication in the API tests related to
the `Stream` and `StreamOwned` types.

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 commit is able to remove most of the duplication for testing these
scenarios, but still leaves some for the server and client contexts.
@cpu cpu force-pushed the cpu-tidy-stream-tests branch from 069359a to 237b333 Compare May 26, 2023 12:11
@cpu
Copy link
Member Author
cpu commented May 26, 2023

Would prefer to standardize on moving helper functions below the relevant tests instead of above them

Done! Thanks for the review. Sorry about missing that convention across a couple PRs. I'll make a note of it for the future.

@cpu cpu merged commit a71223c into rustls:main May 26, 2023
@cpu cpu deleted the cpu-tidy-stream-tests branch May 26, 2023 12:26
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.

2 participants
0