Fix tests

This commit is contained in:
pawan
2020-05-22 18:35:35 +05:30
parent 1be19db3bf
commit 604344bbbc
7 changed files with 31 additions and 9 deletions

View File

@@ -86,9 +86,14 @@ pub fn build_libp2p_instance(
let port = unused_port("tcp").unwrap();
let config = build_config(port, boot_nodes, secret_key);
// launch libp2p service
LibP2PService::new(&config, EnrForkId::default(), &log)
.expect("should build libp2p instance")
.1
LibP2PService::new(
tokio::runtime::Handle::current(),
&config,
EnrForkId::default(),
&log,
)
.expect("should build libp2p instance")
.1
}
#[allow(dead_code)]

View File

@@ -136,9 +136,14 @@ async fn test_secio_noise_fallback() {
let port = common::unused_port("tcp").unwrap();
let noisy_config = common::build_config(port, vec![], None);
let mut noisy_node = Service::new(&noisy_config, EnrForkId::default(), &log)
.expect("should build a libp2p instance")
.1;
let mut noisy_node = Service::new(
tokio::runtime::Handle::current(),
&noisy_config,
EnrForkId::default(),
&log,
)
.expect("should build a libp2p instance")
.1;
let port = common::unused_port("tcp").unwrap();
let secio_config = common::build_config(port, vec![common::get_enr(&noisy_node)], None);

View File

@@ -10,6 +10,7 @@ genesis = { path = "../genesis" }
lazy_static = "1.4.0"
matches = "0.1.8"
tempfile = "3.1.0"
exit-future = "0.2.0"
[dependencies]
beacon_chain = { path = "../beacon_chain" }

View File

@@ -32,7 +32,9 @@ mod tests {
let enrs = vec![enr1, enr2];
let runtime = Runtime::new().unwrap();
let handle = runtime.handle().clone();
let (signal, exit) = exit_future::signal();
let executor = environment::TaskExecutor::new(runtime.handle().clone(), exit, log.clone());
let mut config = NetworkConfig::default();
config.libp2p_port = 21212;
@@ -42,8 +44,9 @@ mod tests {
// Create a new network service which implicitly gets dropped at the
// end of the block.
let _ =
NetworkService::start(beacon_chain.clone(), &config, &handle, log.clone()).unwrap();
let _ = NetworkService::start(beacon_chain.clone(), &config, executor, log.clone())
.unwrap();
drop(signal);
});
runtime.shutdown_timeout(tokio::time::Duration::from_millis(300));