feat(cli): print summary when continuous mode is interrupted
This commit is contained in:
1 parent
f2f5728c72
commit
67ef912ba0
2 files changed
+6
-1
No files matched your search
@@ -29,7 +29,7 @@ pub struct CliArgs {
|
|||||||
default_value = "10s",
|
default_value = "10s",
|
||||||
value_parser = parse_test_duration,
|
value_parser = parse_test_duration,
|
||||||
help = "Test duration; use 0 for continuous mode",
|
help = "Test duration; use 0 for continuous mode",
|
||||||
long_help = "Test duration; use 0 for continuous mode.\n\nFinite runs retain exact statistics for final summaries. Continuous mode uses bounded-memory running statistics and does not print a finite summary."
|
long_help = "Test duration; use 0 for continuous mode.\n\nFinite runs retain exact statistics for final summaries. Continuous mode uses bounded-memory running statistics and prints a final summary only when interrupted."
|
||||||
)]
|
)]
|
||||||
pub duration: Duration,
|
pub duration: Duration,
|
||||||
|
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ fn run(args: CliArgs, shutdown_requested: &AtomicBool) -> Result<(), Box<dyn std
|
|||||||
|
|
||||||
let events = client.close()?;
|
let events = client.close()?;
|
||||||
output.print_events(&events)?;
|
output.print_events(&events)?;
|
||||||
|
output.print_final_summary = should_print_final_summary(continuous, interrupted);
|
||||||
output.print_summary()?;
|
output.print_summary()?;
|
||||||
output.out.flush()?;
|
output.out.flush()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -156,6 +157,10 @@ fn should_drain_final(continuous: bool, interrupted: bool) -> bool {
|
|||||||
!continuous || interrupted
|
!continuous || interrupted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn should_print_final_summary(continuous: bool, interrupted: bool) -> bool {
|
||||||
|
!continuous || interrupted
|
||||||
|
}
|
||||||
|
|
||||||
fn open_event(outcome: &OpenOutcome) -> &ClientEvent {
|
fn open_event(outcome: &OpenOutcome) -> &ClientEvent {
|
||||||
match outcome {
|
match outcome {
|
||||||
OpenOutcome::Started { event, .. } | OpenOutcome::NoTestCompleted { event, .. } => event,
|
OpenOutcome::Started { event, .. } | OpenOutcome::NoTestCompleted { event, .. } => event,
|
||||||
|
|||||||
Reference in new issue
Block a user