mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
clients: snapshot
This commit is contained in:
@@ -52,40 +52,27 @@ fn main() -> brk_client::Result<()> {
|
||||
println!("\nFound {} metrics", metrics.len());
|
||||
|
||||
let mut success = 0;
|
||||
let mut failed = 0;
|
||||
let mut errors: Vec<String> = Vec::new();
|
||||
|
||||
for metric in &metrics {
|
||||
for index in &metric.indexes {
|
||||
let index_str = index.serialize_long();
|
||||
let full_path = format!("{}.by.{}", metric.path, index_str);
|
||||
|
||||
match client.get_metric(
|
||||
metric.name.as_str().into(),
|
||||
*index,
|
||||
None,
|
||||
Some(0),
|
||||
None,
|
||||
Some("-3"),
|
||||
None,
|
||||
) {
|
||||
Ok(response) => {
|
||||
let count = response.json().data.len();
|
||||
if count != 3 {
|
||||
failed += 1;
|
||||
let error_msg = format!(
|
||||
"FAIL: {}.by.{} -> expected 3, got {}",
|
||||
metric.path, index_str, count
|
||||
);
|
||||
errors.push(error_msg.clone());
|
||||
println!("{}", error_msg);
|
||||
} else {
|
||||
success += 1;
|
||||
println!("OK: {}.by.{} -> {} items", metric.path, index_str, count);
|
||||
}
|
||||
Ok(_) => {
|
||||
success += 1;
|
||||
println!("OK: {}", full_path);
|
||||
}
|
||||
Err(e) => {
|
||||
failed += 1;
|
||||
let error_msg = format!("FAIL: {}.by.{} -> {}", metric.path, index_str, e);
|
||||
errors.push(error_msg.clone());
|
||||
println!("{}", error_msg);
|
||||
println!("FAIL: {} -> {}", full_path, e);
|
||||
return Err(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,21 +80,6 @@ fn main() -> brk_client::Result<()> {
|
||||
|
||||
println!("\n=== Results ===");
|
||||
println!("Success: {}", success);
|
||||
println!("Failed: {}", failed);
|
||||
|
||||
if !errors.is_empty() {
|
||||
println!("\nErrors:");
|
||||
for err in errors.iter().take(10) {
|
||||
println!(" {}", err);
|
||||
}
|
||||
if errors.len() > 10 {
|
||||
println!(" ... and {} more", errors.len() - 10);
|
||||
}
|
||||
}
|
||||
|
||||
if failed > 0 {
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user