mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 08:47:57 +00:00
Add new hardware and software metrics (#11062)
* Add new hardware and software metrics * Move sysinfo tests into `mod tests` * Correct a typo in a comment * Remove unnecessary `nix` dependency * Fix the version tests * Add a `--disable-hardware-benchmarks` CLI argument * Disable hardware benchmarks in the integration tests * Remove unused import * Fix benchmarks compilation * Move code to a new `sc-sysinfo` crate * Correct `impl_version` comment * Move `--disable-hardware-benchmarks` to the chain-specific bin crate * Move printing out of hardware bench results to `sc-sysinfo` * Move hardware benchmarks to a separate messages; trigger them manually * Rename some of the fields in the `HwBench` struct * Revert changes to the telemetry crate; manually send hwbench messages * Move sysinfo logs into the sysinfo crate * Move the `TARGET_OS_*` constants into the sysinfo crate * Minor cleanups * Move the `HwBench` struct to the sysinfo crate * Derive `Clone` for `HwBench` * Fix broken telemetry connection notification stream * Prevent the telemetry connection notifiers from leaking if they're disconnected * Turn the telemetry notification failure log into a debug log * Rename `--disable-hardware-benchmarks` to `--no-hardware-benchmarks`
This commit is contained in:
@@ -28,7 +28,7 @@ pub mod common;
|
||||
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"]).await;
|
||||
common::run_node_for_a_while(base_path.path(), &["--dev", "--no-hardware-benchmarks"]).await;
|
||||
|
||||
let status = Command::new(cargo_bin("substrate"))
|
||||
.args(&["check-block", "--dev", "--pruning", "archive", "-d"])
|
||||
|
||||
@@ -188,7 +188,7 @@ async fn export_import_revert() {
|
||||
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"]).await;
|
||||
common::run_node_for_a_while(base_path.path(), &["--dev", "--no-hardware-benchmarks"]).await;
|
||||
|
||||
let mut executor = ExportImportRevertExecutor::new(&base_path, &exported_blocks_file, &db_path);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ pub mod common;
|
||||
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"]).await;
|
||||
common::run_node_for_a_while(base_path.path(), &["--dev", "--no-hardware-benchmarks"]).await;
|
||||
|
||||
let status = Command::new(cargo_bin("substrate"))
|
||||
.args(&["inspect", "--dev", "--pruning", "archive", "-d"])
|
||||
|
||||
@@ -27,7 +27,7 @@ pub mod common;
|
||||
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"]).await;
|
||||
common::run_node_for_a_while(base_path.path(), &["--dev", "--no-hardware-benchmarks"]).await;
|
||||
|
||||
let status = Command::new(cargo_bin("substrate"))
|
||||
.args(&["purge-chain", "--dev", "-d"])
|
||||
|
||||
@@ -38,6 +38,7 @@ async fn running_the_node_works_and_can_be_interrupted() {
|
||||
Command::new(cargo_bin("substrate"))
|
||||
.args(&["--dev", "-d"])
|
||||
.arg(base_path.path())
|
||||
.arg("--no-hardware-benchmarks")
|
||||
.spawn()
|
||||
.unwrap(),
|
||||
);
|
||||
@@ -61,7 +62,7 @@ async fn running_the_node_works_and_can_be_interrupted() {
|
||||
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"])
|
||||
.args(&["--dev", "--tmp", "--ws-port=45789", "--no-hardware-benchmarks"])
|
||||
.spawn()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ async fn telemetry_works() {
|
||||
let mut substrate = substrate
|
||||
.args(&["--dev", "--tmp", "--telemetry-url"])
|
||||
.arg(format!("ws://{} 10", addr))
|
||||
.arg("--no-hardware-benchmarks")
|
||||
.stdout(process::Stdio::piped())
|
||||
.stderr(process::Stdio::piped())
|
||||
.stdin(process::Stdio::null())
|
||||
|
||||
@@ -36,7 +36,7 @@ pub mod common;
|
||||
async fn temp_base_path_works() {
|
||||
let mut cmd = Command::new(cargo_bin("substrate"));
|
||||
let mut child = common::KillChildOnDrop(
|
||||
cmd.args(&["--dev", "--tmp"])
|
||||
cmd.args(&["--dev", "--tmp", "--no-hardware-benchmarks"])
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.spawn()
|
||||
|
||||
@@ -17,13 +17,11 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use assert_cmd::cargo::cargo_bin;
|
||||
use platforms::*;
|
||||
use regex::Regex;
|
||||
use std::process::Command;
|
||||
|
||||
fn expected_regex() -> Regex {
|
||||
Regex::new(r"^substrate (\d+\.\d+\.\d+(?:-.+?)?)-([a-f\d]+|unknown)-(.+?)-(.+?)(?:-(.+))?$")
|
||||
.unwrap()
|
||||
Regex::new(r"^substrate (.+)-([a-f\d]+)$").unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -37,33 +35,17 @@ fn version_is_full() {
|
||||
let captures = expected.captures(output.as_str()).expect("could not parse version in output");
|
||||
|
||||
assert_eq!(&captures[1], env!("CARGO_PKG_VERSION"));
|
||||
assert_eq!(&captures[3], TARGET_ARCH.as_str());
|
||||
assert_eq!(&captures[4], TARGET_OS.as_str());
|
||||
assert_eq!(captures.get(5).map(|x| x.as_str()), TARGET_ENV.map(|x| x.as_str()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_regex_matches_properly() {
|
||||
let expected = expected_regex();
|
||||
|
||||
let captures = expected.captures("substrate 2.0.0-da487d19d-x86_64-linux-gnu").unwrap();
|
||||
let captures = expected.captures("substrate 2.0.0-da487d19d").unwrap();
|
||||
assert_eq!(&captures[1], "2.0.0");
|
||||
assert_eq!(&captures[2], "da487d19d");
|
||||
assert_eq!(&captures[3], "x86_64");
|
||||
assert_eq!(&captures[4], "linux");
|
||||
assert_eq!(captures.get(5).map(|x| x.as_str()), Some("gnu"));
|
||||
|
||||
let captures = expected.captures("substrate 2.0.0-alpha.5-da487d19d-x86_64-linux-gnu").unwrap();
|
||||
let captures = expected.captures("substrate 2.0.0-alpha.5-da487d19d").unwrap();
|
||||
assert_eq!(&captures[1], "2.0.0-alpha.5");
|
||||
assert_eq!(&captures[2], "da487d19d");
|
||||
assert_eq!(&captures[3], "x86_64");
|
||||
assert_eq!(&captures[4], "linux");
|
||||
assert_eq!(captures.get(5).map(|x| x.as_str()), Some("gnu"));
|
||||
|
||||
let captures = expected.captures("substrate 2.0.0-alpha.5-da487d19d-x86_64-linux").unwrap();
|
||||
assert_eq!(&captures[1], "2.0.0-alpha.5");
|
||||
assert_eq!(&captures[2], "da487d19d");
|
||||
assert_eq!(&captures[3], "x86_64");
|
||||
assert_eq!(&captures[4], "linux");
|
||||
assert_eq!(captures.get(5).map(|x| x.as_str()), None);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user