Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit a1d3d50

Browse files
liamaharonkianenigmakoute
authored
Fix try-runtime follow-chain, try-runtime upgrade tuple tests, cli test utils (#13794)
* new test for try-runtime tuple stuff * fix * remove development comment * formatting * remove todo comment * follow-chain working test * refactor common cli testing utils * fix comment * revert Cargo.lock changes * update Cargo.lock * improve doc comment * fix error typo * update Cargo.lock * feature gate try-runtime test * build_substrate cli test util * feature gate follow_chain tests * move fn start_node to test-utils * improve test pkg name * use tokio Child and Command * remove redundant import * fix ci * fix ci * don't leave hanging processes * improved child process cleanup * use existing KillChildOnDrop * remove redundant comment * Update test-utils/cli/src/lib.rs Co-authored-by: Koute <koute@users.noreply.github.com> --------- Co-authored-by: kianenigma <kian@parity.io> Co-authored-by: Koute <koute@users.noreply.github.com>
1 parent c0793b5 commit a1d3d50

File tree

19 files changed

+508
-153
lines changed

19 files changed

+508
-153
lines changed

Cargo.lock

Lines changed: 202 additions & 115 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/node/cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ tokio-util = { version = "0.7.4", features = ["compat"] }
127127
wait-timeout = "0.2"
128128
substrate-rpc-client = { path = "../../../utils/frame/rpc/client" }
129129
pallet-timestamp = { version = "4.0.0-dev", path = "../../../frame/timestamp" }
130+
substrate-cli-test-utils = { path = "../../../test-utils/cli" }
130131

131132
[build-dependencies]
132133
clap = { version = "4.0.9", optional = true }

bin/node/cli/tests/benchmark_block_works.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use assert_cmd::cargo::cargo_bin;
2323
use std::process::Command;
2424
use tempfile::tempdir;
2525

26-
pub mod common;
26+
use substrate_cli_test_utils as common;
2727

2828
/// `benchmark block` works for the dev runtime using the wasm executor.
2929
#[tokio::test]

bin/node/cli/tests/benchmark_pallet_works.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
use assert_cmd::cargo::cargo_bin;
2222
use std::process::Command;
2323

24-
pub mod common;
25-
2624
/// `benchmark pallet` works for the different combinations of `steps` and `repeat`.
2725
#[test]
2826
fn benchmark_pallet_works() {

bin/node/cli/tests/check_block_works.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use assert_cmd::cargo::cargo_bin;
2222
use std::process::Command;
2323
use tempfile::tempdir;
2424

25-
pub mod common;
25+
use substrate_cli_test_utils as common;
2626

2727
#[tokio::test]
2828
async fn check_block_works() {

bin/node/cli/tests/export_import_flow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use regex::Regex;
2323
use std::{fs, path::PathBuf, process::Command};
2424
use tempfile::{tempdir, TempDir};
2525

26-
pub mod common;
26+
use substrate_cli_test_utils as common;
2727

2828
fn contains_error(logged_output: &str) -> bool {
2929
logged_output.contains("Error")

bin/node/cli/tests/inspect_works.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use assert_cmd::cargo::cargo_bin;
2222
use std::process::Command;
2323
use tempfile::tempdir;
2424

25-
pub mod common;
25+
use substrate_cli_test_utils as common;
2626

2727
#[tokio::test]
2828
async fn inspect_works() {

bin/node/cli/tests/purge_chain_works.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use assert_cmd::cargo::cargo_bin;
2020
use std::process::Command;
2121
use tempfile::tempdir;
2222

23-
pub mod common;
23+
use substrate_cli_test_utils as common;
2424

2525
#[tokio::test]
2626
#[cfg(unix)]

bin/node/cli/tests/remember_state_pruning_works.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
use tempfile::tempdir;
2020

21-
pub mod common;
21+
use substrate_cli_test_utils as common;
2222

2323
#[tokio::test]
2424
#[cfg(unix)]

bin/node/cli/tests/running_the_node_and_interrupt.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
use assert_cmd::cargo::cargo_bin;
2121
use nix::sys::signal::Signal::{self, SIGINT, SIGTERM};
2222
use std::{
23-
process::{self, Child, Command},
23+
process::{self, Command},
2424
time::Duration,
2525
};
2626
use tempfile::tempdir;
2727

28-
pub mod common;
28+
use substrate_cli_test_utils as common;
2929

3030
#[tokio::test]
3131
async fn running_the_node_works_and_can_be_interrupted() {
@@ -71,17 +71,8 @@ async fn running_the_node_works_and_can_be_interrupted() {
7171
#[tokio::test]
7272
async fn running_two_nodes_with_the_same_ws_port_should_work() {
7373
common::run_with_timeout(Duration::from_secs(60 * 10), async move {
74-
fn start_node() -> Child {
75-
Command::new(cargo_bin("substrate"))
76-
.stdout(process::Stdio::piped())
77-
.stderr(process::Stdio::piped())
78-
.args(&["--dev", "--tmp", "--ws-port=45789", "--no-hardware-benchmarks"])
79-
.spawn()
80-
.unwrap()
81-
}
82-
83-
let mut first_node = common::KillChildOnDrop(start_node());
84-
let mut second_node = common::KillChildOnDrop(start_node());
74+
let mut first_node = common::KillChildOnDrop(common::start_node());
75+
let mut second_node = common::KillChildOnDrop(common::start_node());
8576

8677
let stderr = first_node.stderr.take().unwrap();
8778
let ws_url = common::extract_info_from_output(stderr).0.ws_url;

0 commit comments

Comments
 (0)