From 47349c09883257b5b1249bcfe66da2ffdaf2a363 Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Thu, 23 Sep 2021 16:55:16 +0100 Subject: [PATCH 01/10] Less sleeps --- Cargo.lock | 42 +++++++++- bin/node/cli/Cargo.toml | 8 +- bin/node/cli/src/chain_spec.rs | 2 +- bin/node/cli/src/service.rs | 6 +- bin/node/cli/tests/common.rs | 81 +++++++++++++++---- .../tests/running_the_node_and_interrupt.rs | 27 +++---- bin/node/cli/tests/temp_base_path_works.rs | 14 ++-- client/executor/src/native_executor.rs | 4 +- 8 files changed, 135 insertions(+), 49 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 37773a4ae3a69..18e74c24a6cec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -332,6 +332,27 @@ dependencies = [ "trust-dns-resolver", ] +[[package]] +name = "async-stream" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625" +dependencies = [ + "async-stream-impl", + "futures-core", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "async-task" version = "4.0.3" @@ -4392,6 +4413,7 @@ dependencies = [ "frame-system", "futures 0.3.16", "hex-literal", + "jsonrpsee-ws-client", "log 0.4.14", "nix", "node-executor", @@ -4449,7 +4471,10 @@ dependencies = [ "substrate-build-script-utils", "substrate-frame-cli", "tempfile", + "tokio", + "tokio-test", "try-runtime-cli", + "wait-timeout", ] [[package]] @@ -10311,9 +10336,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.10.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cf844b23c6131f624accf65ce0e4e9956a8bb329400ea5bcc26ae3a5c20b0b" +checksum = "c2c2416fdedca8443ae44b4527de1ea633af61d8f7169ffa6e72c5b53d24efcc" dependencies = [ "autocfg 1.0.1", "bytes 1.0.1", @@ -10447,6 +10472,19 @@ dependencies = [ "tokio-reactor", ] +[[package]] +name = "tokio-test" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53474327ae5e166530d17f2d956afcb4f8a004de581b3cae10f12006bc8163e3" +dependencies = [ + "async-stream", + "bytes 1.0.1", + "futures-core", + "tokio", + "tokio-stream", +] + [[package]] name = "tokio-tls" version = "0.2.1" diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml index 6a12af4b278b7..0aa1e5b6fe52b 100644 --- a/bin/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -124,6 +124,12 @@ regex = "1" platforms = "1.1" async-std = { version = "1.6.5", features = ["attributes"] } soketto = "0.4.2" +jsonrpsee-ws-client = { version = "0.3.0", default-features = false, features = [ + "tokio1", +] } +tokio = { version = "1.10", features = ["time"] } +tokio-test = "0.4.2" +wait-timeout = "0.2" [build-dependencies] structopt = { version = "0.3.8", optional = true } @@ -135,7 +141,7 @@ try-runtime-cli = { version = "0.10.0-dev", optional = true, path = "../../../ut sc-cli = { version = "0.10.0-dev", path = "../../../client/cli", optional = true } [features] -default = [ "cli" ] +default = ["cli"] cli = [ "node-executor/wasmi-errno", "node-inspect", diff --git a/bin/node/cli/src/chain_spec.rs b/bin/node/cli/src/chain_spec.rs index 352e007a891ba..5e727afa304bb 100644 --- a/bin/node/cli/src/chain_spec.rs +++ b/bin/node/cli/src/chain_spec.rs @@ -265,7 +265,7 @@ pub fn testnet_genesis( .map(|x| &x.0) .chain(initial_nominators.iter()) .for_each(|x| { - if !endowed_accounts.contains(&x) { + if !endowed_accounts.contains(x) { endowed_accounts.push(x.clone()) } }); diff --git a/bin/node/cli/src/service.rs b/bin/node/cli/src/service.rs index acc7df5b1e5a3..b1a3bd4722597 100644 --- a/bin/node/cli/src/service.rs +++ b/bin/node/cli/src/service.rs @@ -86,7 +86,7 @@ pub fn new_partial( let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::( - &config, + config, telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()), executor, )?; @@ -277,7 +277,7 @@ pub fn new_full_base( let _rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams { config, - backend: backend.clone(), + backend, client: client.clone(), keystore: keystore_container.sync_keystore(), network: network.clone(), @@ -507,7 +507,7 @@ pub fn new_light_base( babe_block_import, Some(Box::new(justification_import)), client.clone(), - select_chain.clone(), + select_chain, move |_, ()| async move { let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); diff --git a/bin/node/cli/tests/common.rs b/bin/node/cli/tests/common.rs index 54b9c749bf1de..6a844555bd35c 100644 --- a/bin/node/cli/tests/common.rs +++ b/bin/node/cli/tests/common.rs @@ -30,42 +30,89 @@ use std::{ thread, time::Duration, }; +use tokio::time::timeout; + +static LOCALHOST_WS: &str = "ws://127.0.0.1:9944/"; /// Wait for the given `child` the given number of `secs`. /// /// Returns the `Some(exit status)` or `None` if the process did not finish in the given time. -pub fn wait_for(child: &mut Child, secs: usize) -> Option { - for i in 0..secs { - match child.try_wait().unwrap() { - Some(status) => { - if i > 5 { - eprintln!("Child process took {} seconds to exit gracefully", i); - } - return Some(status) - }, - None => thread::sleep(Duration::from_secs(1)), +pub fn wait_for(child: &mut Child, secs: u64) -> Result { + assert!(secs > 5); + + let result = + wait_timeout::ChildExt::wait_timeout(child, Duration::from_secs(5)).map_err(|_| ())?; + if let Some(exit_status) = result { + Ok(exit_status) + } else { + eprintln!("Child process taking over 5 seconds to exit gracefully"); + let result = wait_timeout::ChildExt::wait_timeout(child, Duration::from_secs(secs - 5)) + .map_err(|_| ())?; + if let Some(exit_status) = result { + Ok(exit_status) + } else { + eprintln!("Took too long to exit (> {} seconds). Killing...", secs); + let _ = child.kill(); + child.wait().unwrap(); + Err(()) } } - eprintln!("Took too long to exit (> {} seconds). Killing...", secs); - let _ = child.kill(); - child.wait().unwrap(); +} - None +pub async fn wait_n_blocks(n: usize, timeout_secs: u64) -> Result<(), tokio::time::error::Elapsed> { + timeout(Duration::from_secs(timeout_secs), wait_n_blocks_from(n, LOCALHOST_WS)).await } -/// Run the node for a while (30 seconds) +/// Wait for at least n blocks to be produced +/// +/// Eg. to wait for 3 blocks or a timeout of 30 seconds: +/// ``` +/// timeout(Duration::from_secs(30), wait_n_blocks("ws://127.0.0.1:9944/", 3)).await; +/// ``` +pub async fn wait_n_blocks_from(n: usize, url: &str) { + let mut built_blocks = std::collections::HashSet::new(); + let mut interval = tokio::time::interval(Duration::from_secs(2)); + + loop { + // We could call remote-externalities like this: + // = remote_externalities::rpc_api::get_finalized_head::("ws://127.0.0.1:9944/".to_string()).await; + // but then we'd need to gen the types to get the BlockT type. + // https://github.com/paritytech/substrate-subxt/blob/aj-metadata-vnext/proc-macro/src/generate_types.rs + + if let Ok(ws_client) = jsonrpsee_ws_client::WsClientBuilder::default().build(url).await { + let block_result: Result = + ::request( + &ws_client, + "chain_getFinalizedHead", + jsonrpsee_ws_client::types::v2::params::JsonRpcParams::NoParams, + ) + .await; + if let Ok(block) = block_result { + built_blocks.insert(block); + if built_blocks.len() > n { + break + } + } + } + interval.tick().await; + } +} + +/// Run the node for a while (3 blocks) pub fn run_node_for_a_while(base_path: &Path, args: &[&str]) { let mut cmd = Command::new(cargo_bin("substrate")); let mut cmd = cmd.args(args).arg("-d").arg(base_path).spawn().unwrap(); // Let it produce some blocks. - thread::sleep(Duration::from_secs(30)); + tokio_test::block_on(wait_n_blocks(3, 30)).unwrap(); + assert!(cmd.try_wait().unwrap().is_none(), "the process should still be running"); // Stop the process kill(Pid::from_raw(cmd.id().try_into().unwrap()), SIGINT).unwrap(); - assert!(wait_for(&mut cmd, 40).map(|x| x.success()).unwrap_or_default()); + assert!(wait_for(&mut cmd, 40).map(|x| x.success()).unwrap()); } /// Run the node asserting that it fails with an error diff --git a/bin/node/cli/tests/running_the_node_and_interrupt.rs b/bin/node/cli/tests/running_the_node_and_interrupt.rs index 03a1826f2f080..e2bd42298c919 100644 --- a/bin/node/cli/tests/running_the_node_and_interrupt.rs +++ b/bin/node/cli/tests/running_the_node_and_interrupt.rs @@ -17,7 +17,6 @@ // along with this program. If not, see . #![cfg(unix)] - use assert_cmd::cargo::cargo_bin; use nix::{ sys::signal::{ @@ -31,16 +30,14 @@ use std::{ convert::TryInto, ops::DerefMut, process::{Child, Command}, - thread, - time::Duration, }; use tempfile::tempdir; pub mod common; -#[test] -fn running_the_node_works_and_can_be_interrupted() { - fn run_command_and_kill(signal: Signal) { +#[tokio::test] +async fn running_the_node_works_and_can_be_interrupted() { + async fn run_command_and_kill(signal: Signal) { let base_path = tempdir().expect("could not create a temp dir"); let mut cmd = Command::new(cargo_bin("substrate")) .args(&["--dev", "-d"]) @@ -48,19 +45,19 @@ fn running_the_node_works_and_can_be_interrupted() { .spawn() .unwrap(); - thread::sleep(Duration::from_secs(20)); + common::wait_n_blocks(3, 30).await.unwrap(); assert!(cmd.try_wait().unwrap().is_none(), "the process should still be running"); kill(Pid::from_raw(cmd.id().try_into().unwrap()), signal).unwrap(); assert_eq!( common::wait_for(&mut cmd, 30).map(|x| x.success()), - Some(true), + Ok(true), "the process must exit gracefully after signal {}", signal, ); } - run_command_and_kill(SIGINT); - run_command_and_kill(SIGTERM); + run_command_and_kill(SIGINT).await; + run_command_and_kill(SIGTERM).await; } struct KillChildOnDrop(Child); @@ -85,8 +82,8 @@ impl DerefMut for KillChildOnDrop { } } -#[test] -fn running_two_nodes_with_the_same_ws_port_should_work() { +#[tokio::test] +async fn running_two_nodes_with_the_same_ws_port_should_work() { fn start_node() -> Child { Command::new(cargo_bin("substrate")) .args(&["--dev", "--tmp", "--ws-port=45789"]) @@ -97,7 +94,7 @@ fn running_two_nodes_with_the_same_ws_port_should_work() { let mut first_node = KillChildOnDrop(start_node()); let mut second_node = KillChildOnDrop(start_node()); - thread::sleep(Duration::from_secs(30)); + let _ = common::wait_n_blocks(3, 30).await; assert!(first_node.try_wait().unwrap().is_none(), "The first node should still be running"); assert!(second_node.try_wait().unwrap().is_none(), "The second node should still be running"); @@ -107,12 +104,12 @@ fn running_two_nodes_with_the_same_ws_port_should_work() { assert_eq!( common::wait_for(&mut first_node, 30).map(|x| x.success()), - Some(true), + Ok(true), "The first node must exit gracefully", ); assert_eq!( common::wait_for(&mut second_node, 30).map(|x| x.success()), - Some(true), + Ok(true), "The second node must exit gracefully", ); } diff --git a/bin/node/cli/tests/temp_base_path_works.rs b/bin/node/cli/tests/temp_base_path_works.rs index c107740b9b0a5..f19576e55fc89 100644 --- a/bin/node/cli/tests/temp_base_path_works.rs +++ b/bin/node/cli/tests/temp_base_path_works.rs @@ -29,25 +29,24 @@ use std::{ io::Read, path::PathBuf, process::{Command, Stdio}, - thread, - time::Duration, }; pub mod common; -#[test] -fn temp_base_path_works() { +#[tokio::test] +async fn temp_base_path_works() { + // Test depends on log output so set RUST_LOG: let mut cmd = Command::new(cargo_bin("substrate")); - let mut cmd = cmd .args(&["--dev", "--tmp"]) + .env("RUST_LOG", "info") .stdout(Stdio::piped()) .stderr(Stdio::piped()) .spawn() .unwrap(); // Let it produce some blocks. - thread::sleep(Duration::from_secs(30)); + common::wait_n_blocks(3, 30).await.unwrap(); assert!(cmd.try_wait().unwrap().is_none(), "the process should still be running"); // Stop the process @@ -58,8 +57,7 @@ fn temp_base_path_works() { let mut stderr = String::new(); cmd.stderr.unwrap().read_to_string(&mut stderr).unwrap(); let re = Regex::new(r"Database: .+ at (\S+)").unwrap(); - let db_path = - PathBuf::from(re.captures(stderr.as_str()).unwrap().get(1).unwrap().as_str().to_string()); + let db_path = PathBuf::from(re.captures(stderr.as_str()).unwrap().get(1).unwrap().as_str()); assert!(!db_path.exists()); } diff --git a/client/executor/src/native_executor.rs b/client/executor/src/native_executor.rs index 38dba55b5f87c..f55b9d3e299af 100644 --- a/client/executor/src/native_executor.rs +++ b/client/executor/src/native_executor.rs @@ -192,7 +192,7 @@ impl WasmExecutor { /// Perform a call into the given runtime. /// - /// The runtime is passed as a [`RuntimeBlob`]. The runtime will be isntantiated with the + /// The runtime is passed as a [`RuntimeBlob`]. The runtime will be instantiated with the /// parameters this `WasmExecutor` was initialized with. /// /// In case of problems with during creation of the runtime or instantation, a `Err` is @@ -250,7 +250,7 @@ impl sp_core::traits::ReadRuntimeVersion for WasmExecutor { } // If the blob didn't have embedded runtime version section, we fallback to the legacy - // way of fetching the verison: i.e. instantiating the given instance and calling + // way of fetching the version: i.e. instantiating the given instance and calling // `Core_version` on it. self.uncached_call( From 52180b65c23994c101576270ee890db6db7e15e0 Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Thu, 23 Sep 2021 17:15:38 +0100 Subject: [PATCH 02/10] No need to use tokio-test crate --- Cargo.lock | 35 ------------------- bin/node/cli/Cargo.toml | 3 +- bin/node/cli/tests/check_block_works.rs | 6 ++-- bin/node/cli/tests/common.rs | 4 +-- .../tests/database_role_subdir_migration.rs | 6 ++-- bin/node/cli/tests/export_import_flow.rs | 6 ++-- bin/node/cli/tests/inspect_works.rs | 6 ++-- bin/node/cli/tests/purge_chain_works.rs | 6 ++-- 8 files changed, 18 insertions(+), 54 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 18e74c24a6cec..3ab93bde82cd5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -332,27 +332,6 @@ dependencies = [ "trust-dns-resolver", ] -[[package]] -name = "async-stream" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625" -dependencies = [ - "async-stream-impl", - "futures-core", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "async-task" version = "4.0.3" @@ -4472,7 +4451,6 @@ dependencies = [ "substrate-frame-cli", "tempfile", "tokio", - "tokio-test", "try-runtime-cli", "wait-timeout", ] @@ -10472,19 +10450,6 @@ dependencies = [ "tokio-reactor", ] -[[package]] -name = "tokio-test" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53474327ae5e166530d17f2d956afcb4f8a004de581b3cae10f12006bc8163e3" -dependencies = [ - "async-stream", - "bytes 1.0.1", - "futures-core", - "tokio", - "tokio-stream", -] - [[package]] name = "tokio-tls" version = "0.2.1" diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml index 0aa1e5b6fe52b..17aa61299dd24 100644 --- a/bin/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -127,8 +127,7 @@ soketto = "0.4.2" jsonrpsee-ws-client = { version = "0.3.0", default-features = false, features = [ "tokio1", ] } -tokio = { version = "1.10", features = ["time"] } -tokio-test = "0.4.2" +tokio = { version = "1.10", features = ["macros", "time"] } wait-timeout = "0.2" [build-dependencies] diff --git a/bin/node/cli/tests/check_block_works.rs b/bin/node/cli/tests/check_block_works.rs index 707fd217e33e8..216bcc6d9fc13 100644 --- a/bin/node/cli/tests/check_block_works.rs +++ b/bin/node/cli/tests/check_block_works.rs @@ -24,11 +24,11 @@ use tempfile::tempdir; pub mod common; -#[test] -fn check_block_works() { +#[tokio::test] +async fn check_block_works() { let base_path = tempdir().expect("could not create a temp dir"); - common::run_node_for_a_while(base_path.path(), &["--dev"]); + common::run_node_for_a_while(base_path.path(), &["--dev"]).await; let status = Command::new(cargo_bin("substrate")) .args(&["check-block", "--dev", "--pruning", "archive", "-d"]) diff --git a/bin/node/cli/tests/common.rs b/bin/node/cli/tests/common.rs index 6a844555bd35c..5a5695054c97f 100644 --- a/bin/node/cli/tests/common.rs +++ b/bin/node/cli/tests/common.rs @@ -100,13 +100,13 @@ pub async fn wait_n_blocks_from(n: usize, url: &str) { } /// Run the node for a while (3 blocks) -pub fn run_node_for_a_while(base_path: &Path, args: &[&str]) { +pub async fn run_node_for_a_while(base_path: &Path, args: &[&str]) { let mut cmd = Command::new(cargo_bin("substrate")); let mut cmd = cmd.args(args).arg("-d").arg(base_path).spawn().unwrap(); // Let it produce some blocks. - tokio_test::block_on(wait_n_blocks(3, 30)).unwrap(); + wait_n_blocks(3, 30).await.unwrap(); assert!(cmd.try_wait().unwrap().is_none(), "the process should still be running"); diff --git a/bin/node/cli/tests/database_role_subdir_migration.rs b/bin/node/cli/tests/database_role_subdir_migration.rs index 516908111ae72..8fabc3be13d99 100644 --- a/bin/node/cli/tests/database_role_subdir_migration.rs +++ b/bin/node/cli/tests/database_role_subdir_migration.rs @@ -25,9 +25,9 @@ use tempfile::tempdir; pub mod common; -#[test] +#[tokio::test] #[cfg(unix)] -fn database_role_subdir_migration() { +async fn database_role_subdir_migration() { type Block = RawBlock>; let base_path = tempdir().expect("could not create a temp dir"); @@ -62,7 +62,7 @@ fn database_role_subdir_migration() { "44445", "--no-prometheus", ], - ); + ).await; // check if the database dir had been migrated assert!(!path.join("db_version").exists()); diff --git a/bin/node/cli/tests/export_import_flow.rs b/bin/node/cli/tests/export_import_flow.rs index 7cbaa152699b4..937f03b8e5dae 100644 --- a/bin/node/cli/tests/export_import_flow.rs +++ b/bin/node/cli/tests/export_import_flow.rs @@ -182,13 +182,13 @@ impl<'a> ExportImportRevertExecutor<'a> { } } -#[test] -fn export_import_revert() { +#[tokio::test] +async fn export_import_revert() { let base_path = tempdir().expect("could not create a temp dir"); let exported_blocks_file = base_path.path().join("exported_blocks"); let db_path = base_path.path().join("db"); - common::run_node_for_a_while(base_path.path(), &["--dev"]); + common::run_node_for_a_while(base_path.path(), &["--dev"]).await; let mut executor = ExportImportRevertExecutor::new(&base_path, &exported_blocks_file, &db_path); diff --git a/bin/node/cli/tests/inspect_works.rs b/bin/node/cli/tests/inspect_works.rs index 2a89801547a4b..6f980d2acbfcb 100644 --- a/bin/node/cli/tests/inspect_works.rs +++ b/bin/node/cli/tests/inspect_works.rs @@ -24,11 +24,11 @@ use tempfile::tempdir; pub mod common; -#[test] -fn inspect_works() { +#[tokio::test] +async fn inspect_works() { let base_path = tempdir().expect("could not create a temp dir"); - common::run_node_for_a_while(base_path.path(), &["--dev"]); + common::run_node_for_a_while(base_path.path(), &["--dev"]).await; let status = Command::new(cargo_bin("substrate")) .args(&["inspect", "--dev", "--pruning", "archive", "-d"]) diff --git a/bin/node/cli/tests/purge_chain_works.rs b/bin/node/cli/tests/purge_chain_works.rs index 0f16a51e5d0a4..8a8601c863d95 100644 --- a/bin/node/cli/tests/purge_chain_works.rs +++ b/bin/node/cli/tests/purge_chain_works.rs @@ -22,12 +22,12 @@ use tempfile::tempdir; pub mod common; -#[test] +#[tokio::test] #[cfg(unix)] -fn purge_chain_works() { +async fn purge_chain_works() { let base_path = tempdir().expect("could not create a temp dir"); - common::run_node_for_a_while(base_path.path(), &["--dev"]); + common::run_node_for_a_while(base_path.path(), &["--dev"]).await; let status = Command::new(cargo_bin("substrate")) .args(&["purge-chain", "--dev", "-d"]) From 89d3d3c3766887509457ce1b2342f106bc7db35a Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Thu, 23 Sep 2021 17:42:36 +0100 Subject: [PATCH 03/10] Less sleep --- bin/node/cli/tests/common.rs | 10 ++++++---- bin/node/cli/tests/database_role_subdir_migration.rs | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/bin/node/cli/tests/common.rs b/bin/node/cli/tests/common.rs index 5a5695054c97f..779998991089a 100644 --- a/bin/node/cli/tests/common.rs +++ b/bin/node/cli/tests/common.rs @@ -27,7 +27,6 @@ use std::{ convert::TryInto, path::Path, process::{Child, Command, ExitStatus}, - thread, time::Duration, }; use tokio::time::timeout; @@ -121,7 +120,10 @@ pub fn run_node_assert_fail(base_path: &Path, args: &[&str]) { let mut cmd = cmd.args(args).arg("-d").arg(base_path).spawn().unwrap(); - // Let it produce some blocks. - thread::sleep(Duration::from_secs(10)); - assert!(cmd.try_wait().unwrap().is_some(), "the process should not be running anymore"); + // Let it produce some blocks, but it should die within 10 seconds. + assert_ne!( + wait_timeout::ChildExt::wait_timeout(&mut cmd, Duration::from_secs(10)).unwrap(), + None, + "the process should not be running anymore" + ); } diff --git a/bin/node/cli/tests/database_role_subdir_migration.rs b/bin/node/cli/tests/database_role_subdir_migration.rs index 8fabc3be13d99..9338d8a8e4f43 100644 --- a/bin/node/cli/tests/database_role_subdir_migration.rs +++ b/bin/node/cli/tests/database_role_subdir_migration.rs @@ -62,7 +62,8 @@ async fn database_role_subdir_migration() { "44445", "--no-prometheus", ], - ).await; + ) + .await; // check if the database dir had been migrated assert!(!path.join("db_version").exists()); From fcfcfb6cd4db5970e91c8c29f198363340a969be Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Fri, 24 Sep 2021 13:57:45 +0100 Subject: [PATCH 04/10] Avoid leaving zombie substrates around (when panicing in tests) --- bin/node/cli/tests/common.rs | 37 ++++++++++++++---- .../tests/running_the_node_and_interrupt.rs | 38 +++++-------------- bin/node/cli/tests/temp_base_path_works.rs | 23 +++++------ 3 files changed, 51 insertions(+), 47 deletions(-) diff --git a/bin/node/cli/tests/common.rs b/bin/node/cli/tests/common.rs index 779998991089a..737be0cc57f1f 100644 --- a/bin/node/cli/tests/common.rs +++ b/bin/node/cli/tests/common.rs @@ -25,6 +25,7 @@ use nix::{ }; use std::{ convert::TryInto, + ops::{Deref, DerefMut}, path::Path, process::{Child, Command, ExitStatus}, time::Duration, @@ -102,28 +103,50 @@ pub async fn wait_n_blocks_from(n: usize, url: &str) { pub async fn run_node_for_a_while(base_path: &Path, args: &[&str]) { let mut cmd = Command::new(cargo_bin("substrate")); - let mut cmd = cmd.args(args).arg("-d").arg(base_path).spawn().unwrap(); + let mut child = KillChildOnDrop(cmd.args(args).arg("-d").arg(base_path).spawn().unwrap()); // Let it produce some blocks. - wait_n_blocks(3, 30).await.unwrap(); + wait_n_blocks(3, 30).await; - assert!(cmd.try_wait().unwrap().is_none(), "the process should still be running"); + assert!(child.try_wait().unwrap().is_none(), "the process should still be running"); // Stop the process - kill(Pid::from_raw(cmd.id().try_into().unwrap()), SIGINT).unwrap(); - assert!(wait_for(&mut cmd, 40).map(|x| x.success()).unwrap()); + kill(Pid::from_raw(child.id().try_into().unwrap()), SIGINT).unwrap(); + assert!(wait_for(&mut child, 40).map(|x| x.success()).unwrap()); } /// Run the node asserting that it fails with an error pub fn run_node_assert_fail(base_path: &Path, args: &[&str]) { let mut cmd = Command::new(cargo_bin("substrate")); - let mut cmd = cmd.args(args).arg("-d").arg(base_path).spawn().unwrap(); + let mut child = KillChildOnDrop(cmd.args(args).arg("-d").arg(base_path).spawn().unwrap()); // Let it produce some blocks, but it should die within 10 seconds. assert_ne!( - wait_timeout::ChildExt::wait_timeout(&mut cmd, Duration::from_secs(10)).unwrap(), + wait_timeout::ChildExt::wait_timeout(&mut *child, Duration::from_secs(10)).unwrap(), None, "the process should not be running anymore" ); } + +pub struct KillChildOnDrop(pub Child); + +impl Drop for KillChildOnDrop { + fn drop(&mut self) { + let _ = self.0.kill(); + } +} + +impl Deref for KillChildOnDrop { + type Target = Child; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl DerefMut for KillChildOnDrop { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} diff --git a/bin/node/cli/tests/running_the_node_and_interrupt.rs b/bin/node/cli/tests/running_the_node_and_interrupt.rs index e2bd42298c919..3edb3dafe452d 100644 --- a/bin/node/cli/tests/running_the_node_and_interrupt.rs +++ b/bin/node/cli/tests/running_the_node_and_interrupt.rs @@ -39,11 +39,13 @@ pub mod common; async fn running_the_node_works_and_can_be_interrupted() { async fn run_command_and_kill(signal: Signal) { let base_path = tempdir().expect("could not create a temp dir"); - let mut cmd = Command::new(cargo_bin("substrate")) - .args(&["--dev", "-d"]) - .arg(base_path.path()) - .spawn() - .unwrap(); + let mut cmd = common::KillChildOnDrop( + Command::new(cargo_bin("substrate")) + .args(&["--dev", "-d"]) + .arg(base_path.path()) + .spawn() + .unwrap(), + ); common::wait_n_blocks(3, 30).await.unwrap(); assert!(cmd.try_wait().unwrap().is_none(), "the process should still be running"); @@ -60,28 +62,6 @@ async fn running_the_node_works_and_can_be_interrupted() { run_command_and_kill(SIGTERM).await; } -struct KillChildOnDrop(Child); - -impl Drop for KillChildOnDrop { - fn drop(&mut self) { - let _ = self.0.kill(); - } -} - -impl Deref for KillChildOnDrop { - type Target = Child; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl DerefMut for KillChildOnDrop { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - #[tokio::test] async fn running_two_nodes_with_the_same_ws_port_should_work() { fn start_node() -> Child { @@ -91,8 +71,8 @@ async fn running_two_nodes_with_the_same_ws_port_should_work() { .unwrap() } - let mut first_node = KillChildOnDrop(start_node()); - let mut second_node = KillChildOnDrop(start_node()); + let mut first_node = common::KillChildOnDrop(start_node()); + let mut second_node = common::KillChildOnDrop(start_node()); let _ = common::wait_n_blocks(3, 30).await; diff --git a/bin/node/cli/tests/temp_base_path_works.rs b/bin/node/cli/tests/temp_base_path_works.rs index f19576e55fc89..c80fe39f42225 100644 --- a/bin/node/cli/tests/temp_base_path_works.rs +++ b/bin/node/cli/tests/temp_base_path_works.rs @@ -37,25 +37,26 @@ pub mod common; async fn temp_base_path_works() { // Test depends on log output so set RUST_LOG: let mut cmd = Command::new(cargo_bin("substrate")); - let mut cmd = cmd - .args(&["--dev", "--tmp"]) - .env("RUST_LOG", "info") - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .spawn() - .unwrap(); + let mut child = common::KillChildOnDrop( + cmd.args(&["--dev", "--tmp"]) + .env("RUST_LOG", "info") + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .unwrap(), + ); // Let it produce some blocks. common::wait_n_blocks(3, 30).await.unwrap(); - assert!(cmd.try_wait().unwrap().is_none(), "the process should still be running"); + assert!(child.try_wait().unwrap().is_none(), "the process should still be running"); // Stop the process - kill(Pid::from_raw(cmd.id().try_into().unwrap()), SIGINT).unwrap(); - assert!(common::wait_for(&mut cmd, 40).map(|x| x.success()).unwrap_or_default()); + kill(Pid::from_raw(child.id().try_into().unwrap()), SIGINT).unwrap(); + assert!(common::wait_for(&mut child, 40).map(|x| x.success()).unwrap_or_default()); // Ensure the database has been deleted let mut stderr = String::new(); - cmd.stderr.unwrap().read_to_string(&mut stderr).unwrap(); + child.stderr.as_mut().unwrap().read_to_string(&mut stderr).unwrap(); let re = Regex::new(r"Database: .+ at (\S+)").unwrap(); let db_path = PathBuf::from(re.captures(stderr.as_str()).unwrap().get(1).unwrap().as_str()); From 30dffc6b09b0c170830ad782fa375d2fdefa06cd Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Mon, 27 Sep 2021 07:35:49 +0100 Subject: [PATCH 05/10] Remove unused imports --- bin/node/cli/tests/common.rs | 2 +- bin/node/cli/tests/running_the_node_and_interrupt.rs | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/bin/node/cli/tests/common.rs b/bin/node/cli/tests/common.rs index 737be0cc57f1f..e2b6ce3447a98 100644 --- a/bin/node/cli/tests/common.rs +++ b/bin/node/cli/tests/common.rs @@ -106,7 +106,7 @@ pub async fn run_node_for_a_while(base_path: &Path, args: &[&str]) { let mut child = KillChildOnDrop(cmd.args(args).arg("-d").arg(base_path).spawn().unwrap()); // Let it produce some blocks. - wait_n_blocks(3, 30).await; + let _ = wait_n_blocks(3, 30).await; assert!(child.try_wait().unwrap().is_none(), "the process should still be running"); diff --git a/bin/node/cli/tests/running_the_node_and_interrupt.rs b/bin/node/cli/tests/running_the_node_and_interrupt.rs index 3edb3dafe452d..372e98849d738 100644 --- a/bin/node/cli/tests/running_the_node_and_interrupt.rs +++ b/bin/node/cli/tests/running_the_node_and_interrupt.rs @@ -25,10 +25,8 @@ use nix::{ }, unistd::Pid, }; -use sc_service::Deref; use std::{ convert::TryInto, - ops::DerefMut, process::{Child, Command}, }; use tempfile::tempdir; From 208f4363e27041178af74d9480bcec39abb20ed9 Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Mon, 27 Sep 2021 16:17:50 +0100 Subject: [PATCH 06/10] Incorporating feedback --- bin/node/cli/Cargo.toml | 4 +--- bin/node/cli/tests/common.rs | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml index 17aa61299dd24..e44ded79e0c9c 100644 --- a/bin/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -124,9 +124,7 @@ regex = "1" platforms = "1.1" async-std = { version = "1.6.5", features = ["attributes"] } soketto = "0.4.2" -jsonrpsee-ws-client = { version = "0.3.0", default-features = false, features = [ - "tokio1", -] } +jsonrpsee-ws-client = { version = "0.3.0", default-features = false, features = [ "tokio1" ] } tokio = { version = "1.10", features = ["macros", "time"] } wait-timeout = "0.2" diff --git a/bin/node/cli/tests/common.rs b/bin/node/cli/tests/common.rs index e2b6ce3447a98..685695b93ffbf 100644 --- a/bin/node/cli/tests/common.rs +++ b/bin/node/cli/tests/common.rs @@ -38,24 +38,23 @@ static LOCALHOST_WS: &str = "ws://127.0.0.1:9944/"; /// /// Returns the `Some(exit status)` or `None` if the process did not finish in the given time. pub fn wait_for(child: &mut Child, secs: u64) -> Result { - assert!(secs > 5); - let result = - wait_timeout::ChildExt::wait_timeout(child, Duration::from_secs(5)).map_err(|_| ())?; + wait_timeout::ChildExt::wait_timeout(child, Duration::from_secs(5.min(secs))).map_err(|_| ())?; if let Some(exit_status) = result { Ok(exit_status) } else { - eprintln!("Child process taking over 5 seconds to exit gracefully"); - let result = wait_timeout::ChildExt::wait_timeout(child, Duration::from_secs(secs - 5)) - .map_err(|_| ())?; - if let Some(exit_status) = result { - Ok(exit_status) - } else { - eprintln!("Took too long to exit (> {} seconds). Killing...", secs); - let _ = child.kill(); - child.wait().unwrap(); - Err(()) + if secs > 5 { + eprintln!("Child process taking over 5 seconds to exit gracefully"); + let result = wait_timeout::ChildExt::wait_timeout(child, Duration::from_secs(secs - 5)) + .map_err(|_| ())?; + if let Some(exit_status) = result { + return Ok(exit_status); + } } + eprintln!("Took too long to exit (> {} seconds). Killing...", secs); + let _ = child.kill(); + child.wait().unwrap(); + Err(()) } } From afefba598212233d3233fb5f73d30641fe516ea9 Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Mon, 27 Sep 2021 16:30:30 +0100 Subject: [PATCH 07/10] rename method --- bin/node/cli/tests/common.rs | 10 +++++----- bin/node/cli/tests/running_the_node_and_interrupt.rs | 4 ++-- bin/node/cli/tests/temp_base_path_works.rs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/node/cli/tests/common.rs b/bin/node/cli/tests/common.rs index 685695b93ffbf..e599b3154c8fb 100644 --- a/bin/node/cli/tests/common.rs +++ b/bin/node/cli/tests/common.rs @@ -58,17 +58,17 @@ pub fn wait_for(child: &mut Child, secs: u64) -> Result { } } -pub async fn wait_n_blocks(n: usize, timeout_secs: u64) -> Result<(), tokio::time::error::Elapsed> { - timeout(Duration::from_secs(timeout_secs), wait_n_blocks_from(n, LOCALHOST_WS)).await +pub async fn wait_n_finalized_blocks(n: usize, timeout_secs: u64) -> Result<(), tokio::time::error::Elapsed> { + timeout(Duration::from_secs(timeout_secs), wait_n_finalized_blocks_from(n, LOCALHOST_WS)).await } /// Wait for at least n blocks to be produced /// /// Eg. to wait for 3 blocks or a timeout of 30 seconds: /// ``` -/// timeout(Duration::from_secs(30), wait_n_blocks("ws://127.0.0.1:9944/", 3)).await; +/// timeout(Duration::from_secs(30), wait_n_finalized_blocks("ws://127.0.0.1:9944/", 3)).await; /// ``` -pub async fn wait_n_blocks_from(n: usize, url: &str) { +pub async fn wait_n_finalized_blocks_from(n: usize, url: &str) { let mut built_blocks = std::collections::HashSet::new(); let mut interval = tokio::time::interval(Duration::from_secs(2)); @@ -105,7 +105,7 @@ pub async fn run_node_for_a_while(base_path: &Path, args: &[&str]) { let mut child = KillChildOnDrop(cmd.args(args).arg("-d").arg(base_path).spawn().unwrap()); // Let it produce some blocks. - let _ = wait_n_blocks(3, 30).await; + let _ = wait_n_finalized_blocks(3, 30).await; assert!(child.try_wait().unwrap().is_none(), "the process should still be running"); diff --git a/bin/node/cli/tests/running_the_node_and_interrupt.rs b/bin/node/cli/tests/running_the_node_and_interrupt.rs index 372e98849d738..fc5094c2d722f 100644 --- a/bin/node/cli/tests/running_the_node_and_interrupt.rs +++ b/bin/node/cli/tests/running_the_node_and_interrupt.rs @@ -45,7 +45,7 @@ async fn running_the_node_works_and_can_be_interrupted() { .unwrap(), ); - common::wait_n_blocks(3, 30).await.unwrap(); + common::wait_n_finalized_blocks(3, 30).await.unwrap(); assert!(cmd.try_wait().unwrap().is_none(), "the process should still be running"); kill(Pid::from_raw(cmd.id().try_into().unwrap()), signal).unwrap(); assert_eq!( @@ -72,7 +72,7 @@ async fn running_two_nodes_with_the_same_ws_port_should_work() { let mut first_node = common::KillChildOnDrop(start_node()); let mut second_node = common::KillChildOnDrop(start_node()); - let _ = common::wait_n_blocks(3, 30).await; + let _ = common::wait_n_finalized_blocks(3, 30).await; assert!(first_node.try_wait().unwrap().is_none(), "The first node should still be running"); assert!(second_node.try_wait().unwrap().is_none(), "The second node should still be running"); diff --git a/bin/node/cli/tests/temp_base_path_works.rs b/bin/node/cli/tests/temp_base_path_works.rs index c80fe39f42225..1be23e2a334c3 100644 --- a/bin/node/cli/tests/temp_base_path_works.rs +++ b/bin/node/cli/tests/temp_base_path_works.rs @@ -47,7 +47,7 @@ async fn temp_base_path_works() { ); // Let it produce some blocks. - common::wait_n_blocks(3, 30).await.unwrap(); + common::wait_n_finalized_blocks(3, 30).await.unwrap(); assert!(child.try_wait().unwrap().is_none(), "the process should still be running"); // Stop the process From ab6d22a3896a4adf0608793f4c7750cc2f1fa11e Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Tue, 28 Sep 2021 11:06:11 +0100 Subject: [PATCH 08/10] Use rpc_api --- Cargo.lock | 1 + bin/node-template/node/src/cli.rs | 2 +- bin/node/cli/Cargo.toml | 3 +- bin/node/cli/tests/common.rs | 46 +++++++++++-------------------- 4 files changed, 20 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4d6a36b483d79..5c48ffdb78219 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4526,6 +4526,7 @@ dependencies = [ "platforms", "rand 0.7.3", "regex", + "remote-externalities", "sc-authority-discovery", "sc-basic-authorship", "sc-chain-spec", diff --git a/bin/node-template/node/src/cli.rs b/bin/node-template/node/src/cli.rs index 8b551051c1b19..8ed1d35ba5f92 100644 --- a/bin/node-template/node/src/cli.rs +++ b/bin/node-template/node/src/cli.rs @@ -35,7 +35,7 @@ pub enum Subcommand { /// Revert the chain to a previous state. Revert(sc_cli::RevertCmd), - /// The custom benchmark subcommmand benchmarking runtime pallets. + /// The custom benchmark subcommand benchmarking runtime pallets. #[structopt(name = "benchmark", about = "Benchmark runtime pallets.")] Benchmark(frame_benchmarking_cli::BenchmarkCmd), } diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml index e44ded79e0c9c..83e32167bf232 100644 --- a/bin/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -124,9 +124,10 @@ regex = "1" platforms = "1.1" async-std = { version = "1.6.5", features = ["attributes"] } soketto = "0.4.2" -jsonrpsee-ws-client = { version = "0.3.0", default-features = false, features = [ "tokio1" ] } +jsonrpsee-ws-client = { version = "0.3.0", default-features = false, features = ["tokio1"] } tokio = { version = "1.10", features = ["macros", "time"] } wait-timeout = "0.2" +remote-externalities = { path = "../../../utils/frame/remote-externalities" } [build-dependencies] structopt = { version = "0.3.8", optional = true } diff --git a/bin/node/cli/tests/common.rs b/bin/node/cli/tests/common.rs index e599b3154c8fb..85effc858e155 100644 --- a/bin/node/cli/tests/common.rs +++ b/bin/node/cli/tests/common.rs @@ -23,6 +23,8 @@ use nix::{ sys::signal::{kill, Signal::SIGINT}, unistd::Pid, }; +use node_primitives::Block; +use remote_externalities::rpc_api; use std::{ convert::TryInto, ops::{Deref, DerefMut}, @@ -38,8 +40,8 @@ static LOCALHOST_WS: &str = "ws://127.0.0.1:9944/"; /// /// Returns the `Some(exit status)` or `None` if the process did not finish in the given time. pub fn wait_for(child: &mut Child, secs: u64) -> Result { - let result = - wait_timeout::ChildExt::wait_timeout(child, Duration::from_secs(5.min(secs))).map_err(|_| ())?; + let result = wait_timeout::ChildExt::wait_timeout(child, Duration::from_secs(5.min(secs))) + .map_err(|_| ())?; if let Some(exit_status) = result { Ok(exit_status) } else { @@ -48,7 +50,7 @@ pub fn wait_for(child: &mut Child, secs: u64) -> Result { let result = wait_timeout::ChildExt::wait_timeout(child, Duration::from_secs(secs - 5)) .map_err(|_| ())?; if let Some(exit_status) = result { - return Ok(exit_status); + return Ok(exit_status) } } eprintln!("Took too long to exit (> {} seconds). Killing...", secs); @@ -58,42 +60,26 @@ pub fn wait_for(child: &mut Child, secs: u64) -> Result { } } -pub async fn wait_n_finalized_blocks(n: usize, timeout_secs: u64) -> Result<(), tokio::time::error::Elapsed> { +/// Wait for at least n blocks to be finalized within a specified time. +pub async fn wait_n_finalized_blocks( + n: usize, + timeout_secs: u64, +) -> Result<(), tokio::time::error::Elapsed> { timeout(Duration::from_secs(timeout_secs), wait_n_finalized_blocks_from(n, LOCALHOST_WS)).await } -/// Wait for at least n blocks to be produced -/// -/// Eg. to wait for 3 blocks or a timeout of 30 seconds: -/// ``` -/// timeout(Duration::from_secs(30), wait_n_finalized_blocks("ws://127.0.0.1:9944/", 3)).await; -/// ``` +/// Wait for at least n blocks to be finalized from a specified node pub async fn wait_n_finalized_blocks_from(n: usize, url: &str) { let mut built_blocks = std::collections::HashSet::new(); let mut interval = tokio::time::interval(Duration::from_secs(2)); loop { - // We could call remote-externalities like this: - // = remote_externalities::rpc_api::get_finalized_head::("ws://127.0.0.1:9944/".to_string()).await; - // but then we'd need to gen the types to get the BlockT type. - // https://github.com/paritytech/substrate-subxt/blob/aj-metadata-vnext/proc-macro/src/generate_types.rs - - if let Ok(ws_client) = jsonrpsee_ws_client::WsClientBuilder::default().build(url).await { - let block_result: Result = - ::request( - &ws_client, - "chain_getFinalizedHead", - jsonrpsee_ws_client::types::v2::params::JsonRpcParams::NoParams, - ) - .await; - if let Ok(block) = block_result { - built_blocks.insert(block); - if built_blocks.len() > n { - break - } + if let Ok(block) = rpc_api::get_finalized_head::(url.to_string()).await { + built_blocks.insert(block); + if built_blocks.len() > n { + break } - } + }; interval.tick().await; } } From ca02ff40326dbedd7ace11dde58f340e8e687fe7 Mon Sep 17 00:00:00 2001 From: Squirrel Date: Wed, 29 Sep 2021 10:35:50 +0100 Subject: [PATCH 09/10] Update bin/node/cli/tests/temp_base_path_works.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- bin/node/cli/tests/temp_base_path_works.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/node/cli/tests/temp_base_path_works.rs b/bin/node/cli/tests/temp_base_path_works.rs index 1be23e2a334c3..39499a1bb791b 100644 --- a/bin/node/cli/tests/temp_base_path_works.rs +++ b/bin/node/cli/tests/temp_base_path_works.rs @@ -39,7 +39,6 @@ async fn temp_base_path_works() { let mut cmd = Command::new(cargo_bin("substrate")); let mut child = common::KillChildOnDrop( cmd.args(&["--dev", "--tmp"]) - .env("RUST_LOG", "info") .stdout(Stdio::piped()) .stderr(Stdio::piped()) .spawn() From b01dc1f57ee9c7d7169693f97f306dccad0f3fb9 Mon Sep 17 00:00:00 2001 From: Squirrel Date: Wed, 29 Sep 2021 10:35:57 +0100 Subject: [PATCH 10/10] Update bin/node/cli/tests/temp_base_path_works.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- bin/node/cli/tests/temp_base_path_works.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/node/cli/tests/temp_base_path_works.rs b/bin/node/cli/tests/temp_base_path_works.rs index 39499a1bb791b..5d8e6c9ec4539 100644 --- a/bin/node/cli/tests/temp_base_path_works.rs +++ b/bin/node/cli/tests/temp_base_path_works.rs @@ -35,7 +35,6 @@ pub mod common; #[tokio::test] async fn temp_base_path_works() { - // Test depends on log output so set RUST_LOG: let mut cmd = Command::new(cargo_bin("substrate")); let mut child = common::KillChildOnDrop( cmd.args(&["--dev", "--tmp"])