Restore ledger-tool print and json commands (#5048)
* Restore ledger-tool print and json commands * Remove obsolete read_ledger()
This commit is contained in:
@ -4,7 +4,6 @@ extern crate solana;
|
||||
use assert_cmd::prelude::*;
|
||||
use solana::blocktree::create_new_tmp_ledger;
|
||||
use solana::genesis_utils::create_genesis_block;
|
||||
use std::cmp;
|
||||
use std::process::Command;
|
||||
use std::process::Output;
|
||||
|
||||
@ -46,22 +45,5 @@ fn nominal() {
|
||||
// Print everything
|
||||
let output = run_ledger_tool(&["-l", &ledger_path, "print"]);
|
||||
assert!(output.status.success());
|
||||
assert_eq!(count_newlines(&output.stdout), ticks);
|
||||
|
||||
// Only print the first N items
|
||||
let count = cmp::min(genesis_block.ticks_per_slot, 5);
|
||||
let output = run_ledger_tool(&["-l", &ledger_path, "-n", &count.to_string(), "print"]);
|
||||
println!("{:?}", output);
|
||||
assert!(output.status.success());
|
||||
assert_eq!(count_newlines(&output.stdout), count as usize);
|
||||
|
||||
// Skip entries with no hashes
|
||||
let output = run_ledger_tool(&["-l", &ledger_path, "-h", "1", "print"]);
|
||||
assert!(output.status.success());
|
||||
assert_eq!(count_newlines(&output.stdout), ticks);
|
||||
|
||||
// Skip entries with fewer than 2 hashes (skip everything)
|
||||
let output = run_ledger_tool(&["-l", &ledger_path, "-h", "2", "print"]);
|
||||
assert!(output.status.success());
|
||||
assert_eq!(count_newlines(&output.stdout), 0);
|
||||
assert_eq!(count_newlines(&output.stdout), ticks + 1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user