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

Add muxer compliance test suite and refactor tests to not depend on libp2p-swarm #27

Merged
merged 9 commits into from
Nov 11, 2022
11 changes: 8 additions & 3 deletions transports/quic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ rustc-args = ["--cfg", "docsrs"]

[dev-dependencies]
async-std = { version = "1.12.0", features = ["attributes"] }
libp2p = { path = "../..", features = ["request-response", "tcp", "yamux", "noise", "async-std"] }
env_logger = "0.9.0"
rand = "0.8.4"
tokio = { version = "1.21.1", features = ["macros", "rt-multi-thread"] }
libp2p = { path = "../..", features = ["tcp", "yamux", "noise", "async-std"] }
libp2p-muxer-test-harness = { path = "../../muxers/test-harness" }
quickcheck = "1"
rand = "0.8.4"
tokio = { version = "1.21.1", features = ["macros", "rt-multi-thread", "time"] }

[[test]]
name = "stream_compliance"
required-features = ["async-std"]
5 changes: 4 additions & 1 deletion transports/quic/src/connection/substream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ impl AsyncWrite for Substream {
Poll::Ready(Err(io::Error::new(io::ErrorKind::ConnectionReset, err)))
}
Err(quinn_proto::FinishError::UnknownStream) => {
Poll::Ready(Err(io::ErrorKind::BrokenPipe.into()))
// We never make up IDs so the stream must have existed at some point if we get to here.
// `UnknownStream` is also emitted in case the stream is already finished, hence just
// return `Ok(())` here.
Poll::Ready(Ok(()))
}
}
}
Expand Down