test: replace net2
dependency with socket2
#635
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The proxy's integration tests depend on the
net2
crate, which has beendeprecated and replaced by
socket2
. Sincenet2
is no longer activelymaintained,
cargo audit
will warn us about it, so we should replace itwith
socket2
.While I was making this change, I was curious why we were manually
constructing and binding these sockets at all, rather than just using
tokio::net::TcpListener::bind
. After some archaeology, I determinedthat this was added in linkerd/linkerd2#952, which added a test that
requires a delay between when a socket is bound and when it starts
listening.
tokio::net::TcpListener::bind
(as well as thestd::net
version) perform these operations together. Since this wasn't obvious
from the test code, I went ahead and moved the new
socket2
version ofthis into a pair of functions, with comments explaining why we didn't
just use
tokio::net
.Fixes linkerd/linkerd2#4891