bugfix: restore and fix node throughput tester (#6849)

This commit is contained in:
Jędrzej Stuczyński
2026-06-09 15:19:37 +01:00
committed by GitHub
parent 26955dd74b
commit f944348216
3 changed files with 24 additions and 1 deletions
@@ -6,6 +6,7 @@ use crate::logging::granual_filtered_env;
use crate::throughput_tester::test_mixing_throughput;
use anyhow::bail;
use humantime_serde::re::humantime;
use indicatif::ProgressStyle;
use nym_bin_common::logging::default_tracing_fmt_layer;
use std::env::temp_dir;
use std::path::PathBuf;
@@ -40,6 +41,9 @@ pub struct Args {
fn init_test_logger() -> anyhow::Result<()> {
let indicatif_layer = IndicatifLayer::new()
.with_progress_style(ProgressStyle::with_template(
"{span_child_prefix}{spinner} {span_fields} -- {span_name} {wide_msg}",
)?)
.with_span_child_prefix_symbol("")
.with_span_child_prefix_indent(" ");
+7 -1
View File
@@ -85,7 +85,13 @@ pub(crate) struct Cli {
}
impl Cli {
#[allow(clippy::unreachable)]
pub(crate) fn execute(self) -> anyhow::Result<()> {
// test_throughput sets up its own logger and builds a runtime internally.
if let Commands::TestThroughput(args) = self.command {
return test_throughput::execute(args);
}
let runtime = tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()?;
@@ -104,7 +110,7 @@ impl Cli {
Commands::Run(args) => run::execute(*args).await?,
Commands::Migrate(args) => migrate::execute(*args)?,
Commands::Sign(args) => sign::execute(args).await?,
Commands::TestThroughput(args) => test_throughput::execute(args)?,
Commands::TestThroughput(..) => unreachable!(),
Commands::UnsafeResetSphinxKeys(args) => reset_sphinx_keys::execute(args).await?,
Commands::Debug(debug) => match debug.command {
DebugCommands::ResetProvidersGatewayDbs(args) => {
+13
View File
@@ -9,6 +9,7 @@ use crate::throughput_tester::global_stats::GlobalStatsUpdater;
use crate::throughput_tester::stats::ClientStats;
use futures::future::join_all;
use human_repr::HumanDuration;
use indicatif::{ProgressState, ProgressStyle};
use nym_task::ShutdownToken;
use rand::{Rng, thread_rng};
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
@@ -123,6 +124,18 @@ pub(crate) fn test_mixing_throughput(
}
let header_span = info_span!("header");
header_span.pb_set_style(
&ProgressStyle::with_template(
"testing mixing throughput of this machine... {wide_msg} {elapsed}\n{wide_bar}",
)?
.with_key(
"elapsed",
|state: &ProgressState, writer: &mut dyn std::fmt::Write| {
let _ = writer.write_str(&format!("{}", state.elapsed().human_duration()));
},
)
.progress_chars("---"),
);
header_span.pb_start();
// Bit of a hack to show a full "-----" line underneath the header.