ping/rust: Update rust-sdk patch, remove unused dependencies (#42)

* ping/rust: remove unused dependencies

* README: fix import instructions

* ping/rust: set channel capacity to # of instances

* ping/rust: use testground-v0.4.0 from crates.io
This commit is contained in:
Elena Frank 2022-10-04 13:42:33 +02:00 committed by GitHub
parent 5b5b653430
commit c71602e88c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 261 additions and 263 deletions

View File

@ -20,7 +20,7 @@ When a new version of libp2p is released, we want to make it permanent in the `p
- update the `go-libp2p` version, go version, and update the code if needed.
- then `go get -tags v$B && go mod tidy`
3. Run the test on your machine
- Do once, from the test-plans root: import the test-plans with `testground plan import ./ --name libp2p`
- Do once, from the test-plans root: import the test-plans with `testground plan import --from ./ --name libp2p`
- Run the test with `testground run composition -f ping/_compositions/go-cross-versions.toml --wait`
## How to add a new version to ping/rust

507
ping/rust/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -7,13 +7,11 @@ version = "0.1.0"
async-std = {version = "1.10", features = ["attributes", "tokio1"]}
env_logger = "0.9.0"
if-addrs = "0.7.0"
ipnetwork = {version = "0.19.0", default-features = false, features = ["serde"]}
log = "0.4"
rand = "0.8"
serde = {version = "1", features = ["derive"]}
serde_json = "1"
soketto = "0.7.1"
testground = {git = "https://github.com/testground/sdk-rust", rev = "94a9a72796f94cc7ca786a5f019d07f328c76d4b", version = "0.4.0"}
testground = "0.4.0"
thiserror = "1"
tokio = { version = "1", default-features = false, features = ["sync", "rt-multi-thread", "macros", "net"] }
tokio-stream = { version = "0.1", default-features = false, features = [] }
@ -26,4 +24,4 @@ libp2pv0460 = {package = "libp2p", default_features = false, features = [ "webso
libp2pv0470 = {package = "libp2p", default_features = false, features = [ "websocket", "mplex", "yamux", "tcp-async-io", "ping", "noise", "dns-async-std" ], version = "0.47.0", optional = true}
libp2pv0480 = {package = "libp2p", default_features = false, features = [ "websocket", "mplex", "yamux", "tcp-async-io", "ping", "noise", "dns-async-std", "rsa" ], version = "0.48.0", optional = true}
libp2pmaster = {package = "libp2p", git = "https://github.com/libp2p/rust-libp2p", branch = "master", default_features = false, features = [ "websocket", "mplex", "yamux", "tcp-async-io", "ping", "noise", "dns-async-std", "rsa" ], optional = true}
libp2pmaster = {package = "libp2p", git = "https://github.com/libp2p/rust-libp2p", branch = "master", default_features = false, features = [ "websocket", "mplex", "yamux", "tcp-async-io", "ping", "noise", "dns-async-std", "rsa" ], optional = true}

View File

@ -87,10 +87,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
e => panic!("Unexpected event {:?}", e),
}
let test_instance_count = client.run_parameters().test_instance_count as usize;
let mut address_stream = client
.subscribe("peers")
.subscribe("peers", test_instance_count)
.await
.take(client.run_parameters().test_instance_count as usize)
.take(test_instance_count)
.map(|a| {
let value = a.unwrap();
let addr = value["Addrs"][0].as_str().unwrap();
@ -199,9 +200,9 @@ async fn ping(
info!("Wait to receive ping from each peer.");
let mut pinged = HashSet::new();
while pinged.len() < client.run_parameters().test_instance_count as usize - 1 {
if let SwarmEvent::Behaviour(ping::PingEvent {
if let SwarmEvent::Behaviour(ping::Event {
peer,
result: Ok(ping::PingSuccess::Ping { .. }),
result: Ok(ping::Success::Ping { .. }),
}) = swarm.next().await.unwrap()
{
if pinged.insert(peer) {