You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This branch introduces a new style of tests to the proxy codebase, and
an initial implementation of new test support code for writing tests in
this style. Rather than running an entire proxy alongside a simulated
control plane, and binding actual network socket, as the present
integration tests do, the new tests run individual proxy components in
isolation, using simpler mock implementations of components like name
resolution and IO.
This approach has a few advantages. It should reduce flakiness
significantly, since we don't perform any IO and don't need to
synchronize events between multiple threads running test support
servers/controllers (the new mocks all just synchronously provide values
immediately). We can run everything in a single thread using Tokio's
basic scheduler. Additionally, since we are testing individual
components in isolation, these tests can live within the crate for the
part of the proxy being tested. This means we have access to more
internal state to make assertions on, rather than having to make
assertions on side effects like metrics.
I've added a new `linkerd2-app-test` crate that adds some initial mocks
for this kind of testing, including a simple mock resolver and a mock
connector using `tokio-test`'s mock IO. I've also added a simple "hello
world" test for the outbound TCP stack written in this style. The
intention is to use the new test support code for testing the recent
changes adding TCP mTLS and load-balancing.
In order to make this code more testable, it was necessary to move a few
things around. In particular, the outbound TCP balancer stack is now
constructed in a separate method, rather than in `Config::build_server`,
so that it can be tested without requiring all the dependencies of the
full HTTP server stack. A few other similar changes were also necessary.
Signed-off-by: Eliza Weisman <[email protected]>
0 commit comments