-
Notifications
You must be signed in to change notification settings - Fork 271
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
refactor(http/retry): port remaining ReplayBody
tests to Frame<T>
#3567
refactor(http/retry): port remaining ReplayBody
tests to Frame<T>
#3567
Conversation
see linkerd/linkerd2#8733. this commit upgrades a test that uses defunct `data()` and `trailers()` futures. Signed-off-by: katelyn martin <[email protected]>
see linkerd/linkerd2#8733. this commit upgrades a test that uses defunct `data()` and `trailers()` futures. Signed-off-by: katelyn martin <[email protected]>
this commit adds a method that exposes the inner `B`-typed body's `is_end_stream()` trait method, gated for use in tests. Signed-off-by: katelyn martin <[email protected]>
this is a refactoring commit, upgrading more of the replay body test to work in terms of `Frame<T>`. this updates the `body_to_string()` helper in particular. Signed-off-by: katelyn martin <[email protected]>
Signed-off-by: katelyn martin <[email protected]>
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.
review notes...
@@ -808,40 +803,58 @@ mod tests { | |||
async fn eos_only_when_fully_replayed() { |
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.
this test was marginally tricky to port.
i discovered a small, interesting tidbit in that the replay body won't report itself as finished until the trailers are (not) yielded. that matches the existing behavior, it's just slightly more noticeable in the poll_frame(..)
era.
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.
nb: that's fine, in fact.
A return value of false does not guarantee that a value will be returned from poll_frame.
it's okay if we are slightly pessimistic about returning true
; a false negative is acceptable, a false positive is not.
initial.trailers().await.expect("trailers should not error"); | ||
// Read the initial body, show that the replay does not consider itself to have reached the | ||
// end-of-stream. Then drop the initial body, show that the replay is still not done. | ||
assert!(!initial.is_end_stream()); | ||
initial | ||
.frame() | ||
.await | ||
.expect("yields a result") | ||
.expect("yields a frame") | ||
.into_data() | ||
.expect("yields a data frame"); |
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.
nb: we don't use the body_to_string()
helper, or a closure, in this test because we're explicitly concerned with the outcome of is_end_stream()
before/after a previous replay is dropped.
async fn body_to_string<T>(mut body: T) -> String | ||
async fn body_to_string<B>(body: B) -> (String, Option<HeaderMap>) |
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.
now that we have a single frame()
method, this function knows the body is done when it gets either a None
or a Some(Ok(trailers))
. as a result, we return a (data, trls)
tuple here.
pr's #3564 and #3567, 1eb822f and 3204278 respectively, replaced uses of defunct `http_body::Body` trait methods — namely, `data()` and `trailers()`. this commit updates two remaining uses of `data()` that were missed in this initial pass. see linkerd/linkerd2#8733 for more information. Signed-off-by: katelyn martin <[email protected]>
pr's #3564 and #3567, 1eb822f and 3204278 respectively, replaced uses of defunct `http_body::Body` trait methods — namely, `data()` and `trailers()`. this commit updates two remaining uses of `data()` that were missed in this initial pass. see linkerd/linkerd2#8733 for more information. Signed-off-by: katelyn martin <[email protected]>
pr's #3564 and #3567, 1eb822f and 3204278 respectively, replaced uses of defunct `http_body::Body` trait methods — namely, `data()` and `trailers()`. this commit updates two remaining uses of `data()` that were missed in this initial pass. see linkerd/linkerd2#8733 for more information. Signed-off-by: katelyn martin <[email protected]>
based on #3564. see linkerd/linkerd2#8733.
this branch upgrades the remaining parts of the
ReplayBody<B>
test suite to poll bodies in terms ofFrame<T>
s.