Skip to content
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

[pull] main from linkerd:main #197

Merged
merged 7 commits into from
Mar 4, 2025
Merged

[pull] main from linkerd:main #197

merged 7 commits into from
Mar 4, 2025

Conversation

pull[bot]
Copy link

@pull pull bot commented Mar 4, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

cratelyn added 7 commits March 3, 2025 16:20
elsewhere in our codebase, we follow a pattern that can be called a
"new service". this is a `Service<T>` whose response `S` is itself
a `Service<U>`.

new services are often useful for dealing with particular connection
semantics, and provide us a way to model a connection that services many
requests.

our test server code makes use of a `Svc`, which wraps a reference to a
map of uri's and routes. there is an associated `NewSvc` type that does
not provide any material benefit. this `NewSvc` type is a `Service<()>`
that never exerts backpressure, nor performs any action besides
`Arc::clone`ing the map of routes.

this commit golfs down `linkerd_app_integration::server::Server`, by
directly cloning the routes into a `Svc(_)`, without the need for
polling a future or handling an (impossible) error.

Signed-off-by: katelyn martin <[email protected]>
`linkerd_app_integration::tcp` provides a `TcpServer` type that is
distinct from the primary `linkerd_app_integration::server::Server` type
broadly used in integration tests.

this commit makes a small change to reduce indirection, and clarify that
this is constructing a different server implementation from a
different submodule.

this removes `linkerd_app_integration::server::tcp()`, and updates test
code to call the `tcp::server()` function that this is masking.

Signed-off-by: katelyn martin <[email protected]>
the test server implementation in `linkerd_app_integration` defines an
`BoxError` alias. we have a boxed error type in
`linkerd_app_core::Error` that achieves the same purpose, that we can
use instead.

this commit replaces this type alias with a reëxport of
`linkerd_app_core::Error`.

see also, #3685, which removed another similar alias.

Signed-off-by: katelyn martin <[email protected]>
these constants exist, and are generally considered a best practice for
these situations.

this commit replaces numeric literals with named constants.

Signed-off-by: katelyn martin <[email protected]>
* nit(app/integration): add whitespace for consistency

we follow a convention of an empty line between functions.

this commit adds an empty line.

Signed-off-by: katelyn martin <[email protected]>

* nit(app/integration): remove whitespace for consistency

Signed-off-by: katelyn martin <[email protected]>

* nit(app/integration): add whitespace for consistency

Signed-off-by: katelyn martin <[email protected]>

---------

Signed-off-by: katelyn martin <[email protected]>
* refactor(app/integration): remove `Request`, `Response` aliases

see linkerd/linkerd2#8733.

this commit removes two type aliases from our test server
implementation. these are each tied to the defunct `hyper::Body` type.

since much of this code was originally written (between 2017 and 2020)
we've since developed some patterns / idioms elsewhere for dealing with
request and response bodies.

to help set the stage for tweaks to which interfaces need
`hyper::body::Incoming`, which types work with our general default of
`BoxBody`, and which can be generic across arbitrary `B`-typed bodies,
we remove these aliases and provide the body parameter to `Request` and
`Response`.

Signed-off-by: katelyn martin <[email protected]>

* refactor(app/integration): remove `Request`, `Response` aliases

see linkerd/linkerd2#8733.

this commit removes two type aliases from our test client
implementation. these are each tied to the defunct `hyper::Body` type.

since much of this code was originally written (between 2017 and 2020)
we've since developed some patterns / idioms elsewhere for dealing with
request and response bodies.

to help set the stage for tweaks to which interfaces need
`hyper::body::Incoming`, which types work with our general default of
`BoxBody`, and which can be generic across arbitrary `B`-typed bodies,
we remove these aliases and provide the body parameter to `Request` and
`Response`.

Signed-off-by: katelyn martin <[email protected]>

---------

Signed-off-by: katelyn martin <[email protected]>
this commit removes some misdirection from the various constructors for
our test server.

currently, we expose a family of constructor functions `server::new()`,
`server::http1()`, ..., and so forth.

each of these invoke a private `server::Server::http1()`,
`server::Server::http2()`, `server::Server::http2_tls()`, ...,
counterpart, which then delegates down once more to another private
constructor `server::Server::new()`.

this is all a bit roundabout, particularly because these private
constructors are not used by any other internal code in the `server`
submodule.

this commit removes these inherent `Server` constructors, since they are
private and not used by any test code. each free-standing constructor
function is altered to instead directly construct a `Server`.

Signed-off-by: katelyn martin <[email protected]>
@pull pull bot added the ⤵️ pull label Mar 4, 2025
@pull pull bot merged commit 4e3119c into makesoftwaresafe:main Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant