mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-08-01 15:15:42 +00:00
[subsystem-benchmarks] Fix availability-write regression tests (#3698)
Adds availability-write regression tests. The results for the `availability-distribution` subsystem are volatile, so I had to reduce the precision of the test.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
//! Test usage implementation
|
||||
|
||||
use colored::Colorize;
|
||||
use itertools::Itertools;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
|
||||
@@ -37,10 +38,16 @@ impl std::fmt::Display for BenchmarkUsage {
|
||||
self.network_usage
|
||||
.iter()
|
||||
.map(|v| v.to_string())
|
||||
.sorted()
|
||||
.collect::<Vec<String>>()
|
||||
.join("\n"),
|
||||
format!("{:<32}{:>12}{:>12}", "CPU usage, seconds", "total", "per block").blue(),
|
||||
self.cpu_usage.iter().map(|v| v.to_string()).collect::<Vec<String>>().join("\n")
|
||||
self.cpu_usage
|
||||
.iter()
|
||||
.map(|v| v.to_string())
|
||||
.sorted()
|
||||
.collect::<Vec<String>>()
|
||||
.join("\n")
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -101,8 +108,8 @@ fn check_resource_usage(
|
||||
None
|
||||
} else {
|
||||
Some(format!(
|
||||
"The resource `{}` is expected to be equal to {} with a precision {}, but the current value is {}",
|
||||
resource_name, base, precision, usage.per_block
|
||||
"The resource `{}` is expected to be equal to {} with a precision {}, but the current value is {} ({})",
|
||||
resource_name, base, precision, usage.per_block, diff
|
||||
))
|
||||
}
|
||||
} else {
|
||||
@@ -119,7 +126,7 @@ pub struct ResourceUsage {
|
||||
|
||||
impl std::fmt::Display for ResourceUsage {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(f, "{:<32}{:>12.3}{:>12.3}", self.resource_name.cyan(), self.total, self.per_block)
|
||||
write!(f, "{:<32}{:>12.4}{:>12.4}", self.resource_name.cyan(), self.total, self.per_block)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user