Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(app/test): minor tweaks to
linkerd-app-test
(#3428)
while handling the upgrade to hyper 1.0, i noticed some small changes that'd be nice to make. most importantly, with respect to linkerd/linkerd2#8733, this commit outlines `http_util::http_request()`. hyper 1.0 provides version specific `SendRequest` types for HTTP/1 and HTTP/2, so rather than try to be polymorphic across both senders, we send the request at the call site. two other commits remove `pub` attributes for functions that aren't called externally. we'll address `run_proxy()` and `connect_client()` in a subsequent PR, because the dependent tests use both HTTP/1 and HTTP/2. --- * refactor(app/test): remove `pub` from `http_util::connect_client()` this is not used elsewhere. it can be private. Signed-off-by: katelyn martin <kate@buoyant.io> * refactor(app/test): remove `pub` from `http_util::run_proxy()` Signed-off-by: katelyn martin <kate@buoyant.io> * refactor(app/test): remove `http_util::http_request()` this function abstracts over one statement, at the cost of needing to name the `SendRequest` type. because hyper's 1.0 interface provides multiple `SendRequest` types based on the HTTP version being used. to avoid needing to deal with polymorphism, and to implicitly address a function-level allowance of deprecated types, we remove this function and move this statement to the function's call sites. Signed-off-by: katelyn martin <kate@buoyant.io> * refactor(app/test): collect bodies with `String::from_utf8` this function previously called `std::str::from_utf8`, before calling `str::to_owned` on the result. because of this, there is a bit of extra gymnastics, passing a `&body[..]` slice along after collecting the body bytes. this is both more baroque and less performant. this commit updates the call, using `String::from_utf8` to collect the body, sparing a needless `to_owned()`/`clone()` call. Signed-off-by: katelyn martin <kate@buoyant.io> * docs(app/test): document `io` submodule Signed-off-by: katelyn martin <kate@buoyant.io> * refactor(app/test): remove duplicate `io` reëxport the same `pub use` bundle is found in the parent `lib.rs`. this removes it, and refers to the same `mod io {}` defined above. Signed-off-by: katelyn martin <kate@buoyant.io> * review(app/inbound): use `ServiceExt::oneshot(..)` #3428 (comment) we can simplify these statements sending requests, by using `ServiceExt::oneshot(..)`. Signed-off-by: katelyn martin <kate@buoyant.io> --------- Signed-off-by: katelyn martin <kate@buoyant.io>
- Loading branch information