Skip to content

Commit

Permalink
modify tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alindima committed Dec 21, 2023
1 parent 7f05dcd commit 51d68e7
Show file tree
Hide file tree
Showing 9 changed files with 249 additions and 179 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ mod tests {
use futures::{executor, future};

use parity_scale_codec::Encode;
use sc_network::ProtocolName;
use sp_core::testing::TaskExecutor;

use polkadot_node_primitives::BlockData;
Expand Down Expand Up @@ -231,7 +232,10 @@ mod tests {
Some(Requests::PoVFetchingV1(outgoing)) => {outgoing}
);
req.pending_response
.send(Ok(PoVFetchingResponse::PoV(pov.clone()).encode()))
.send(Ok((
PoVFetchingResponse::PoV(pov.clone()).encode(),
ProtocolName::from(""),
)))
.unwrap();
break
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use futures::{
Future, FutureExt, StreamExt,
};

use sc_network as network;
use sc_network::{self as network, ProtocolName};
use sp_keyring::Sr25519Keyring;

use polkadot_node_network_protocol::request_response::{v1, Recipient};
Expand Down Expand Up @@ -252,7 +252,7 @@ impl TestRun {
}
}
req.pending_response
.send(response.map(Encode::encode))
.send(response.map(|r| (r.encode(), ProtocolName::from(""))))
.expect("Sending response should succeed");
}
return (valid_responses == 0) && self.valid_chunks.is_empty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use std::{
time::Duration,
};

use network::ProtocolName;
use polkadot_node_subsystem_test_helpers::TestSubsystemContextHandle;
use polkadot_node_subsystem_util::TimeoutExt;

Expand Down Expand Up @@ -324,7 +325,11 @@ fn to_incoming_req(
let response = rx.await;
let payload = response.expect("Unexpected canceled request").result;
pending_response
.send(payload.map_err(|_| network::RequestFailure::Refused))
.send(
payload
.map_err(|_| network::RequestFailure::Refused)
.map(|r| (r, ProtocolName::from(""))),
)
.expect("Sending response is expected to work");
}
.boxed(),
Expand Down
Loading

0 comments on commit 51d68e7

Please sign in to comment.