-
Notifications
You must be signed in to change notification settings - Fork 743
Reorganize extensions testing #2443
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
Conversation
ded2878
to
be959e7
Compare
Benchmark resultsInstruction countsSignificant differencesThere are no significant instruction count differences Other differencesClick to expand
Wall-timeSignificant differencesThere are no significant wall-time differences Other differencesClick to expand
Additional informationCheckout details:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2443 +/- ##
==========================================
- Coverage 95.26% 95.25% -0.02%
==========================================
Files 95 95
Lines 21256 21256
==========================================
- Hits 20250 20247 -3
- Misses 1006 1009 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9bb2683
to
eb2bbd3
Compare
eb2bbd3
to
4286587
Compare
I've been playing with this because I find the proposed interface pretty hard to grok. I wonder whether it could be built around something more like this: trait ExtensionEncoder {
fn encode<'a>(&self, ext: &impl Extension<'a>) -> Result<bool, ()>;
}
trait Extension<'a>: Codec<'a> {
fn ext_type(&self) -> ExtensionType;
} |
7c15171
to
c2765db
Compare
c2765db
to
382cbe1
Compare
@djc ready for another look -- this no longer adds any code to the core crate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I'm a big fan.
I think you have the original goal that most of the tests should be on the outside of the crate, but I am not entirely sure that I understand the value of this ideal. It seems reasonable to me to have tests written on the inside of the crate boundary, especially since we can also use modules as an abstraction boundary. On the other hand, it comes with this crutch of the internals
module which is like semi-public but not stable, which works around rather than with a bunch of the tooling.
But the idea of growing a second implementation of encoding and decoding messages seems suboptimal to me -- this is adding a whole bunch of code for the sole purpose of supporting some tests that want to inspect/change messages that contain extensions, which means we now have to review/maintain a lot of test-only code in addition to the production library code that is our actual product.
I agree with is that it is better to have higher-level tests that are not tightly integrated to low-level (internal) APIs, but I think I prefer some kind of mid-level API that avoids too much integration without requiring what is substantially a rewrite of the logic used in the library -- and I think it would be okay to have that inside the library.
(I also think both our 8.5k-line tests/api.rs
and 3.4k-line msgs/handshake.rs
could both more organization/splitting up.)
&[0u8; 32], | ||
&[0], | ||
vec![ | ||
ClientHello { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest doing this function -> struct
conversion in a separate commit.
I think the main issue here is we are testing several different things, but testing them in the same way. The original purpose of The other property of those tests is they don't become invalid from testing rustls against itself. In other words, if we screw up the encoding and decoding of a As time has gone on we've added to Lastly, the other constraint is the desire to have tightly defined and misuse-resistant internal APIs, that those by design make it more difficult to construct erroneous messages for testing. As an example, ffac73a makes it impossible to represent the clienthello issued by Line 1549 in 7f8df89
tldr: onboard with moving the protocol tests into the crate, but i still think some of the encoding cases need to diverge from the "real" code |
This seems to be extremely difficult:
|
The goal of this PR is to provide a single internal API surface for all our extension testing needs. A similar idea was previously included in #1475; this is a variation that replaces that.
That allows us to remove
ClientExtension
andServerExtension
fromrustls::internals
, and then further privatize types that were reachable from there.