From aa74cd0b65b7ac0eef051152239cc1d6da2f063c Mon Sep 17 00:00:00 2001 From: Jarno Rajahalme Date: Fri, 11 Jun 2021 20:12:28 -0700 Subject: [PATCH 1/2] test: Move pause from test to action Move the pause on fail wait from test to action, so that nothing happens after the failed action. Signed-off-by: Jarno Rajahalme --- connectivity/check/action.go | 4 ++++ connectivity/check/test.go | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/connectivity/check/action.go b/connectivity/check/action.go index 907c64c58c..436a606d97 100644 --- a/connectivity/check/action.go +++ b/connectivity/check/action.go @@ -157,6 +157,10 @@ func (a *Action) Run(f func(*Action)) { a.printFlows(a.Source()) a.printFlows(a.Destination()) } + if a.failed && a.test.ctx.params.PauseOnFail { + a.Log("Pausing after action failure, press the Enter key to continue:") + fmt.Scanln() + } } // fail marks the Action as failed. diff --git a/connectivity/check/test.go b/connectivity/check/test.go index adedbce657..e3d3b0e8b3 100644 --- a/connectivity/check/test.go +++ b/connectivity/check/test.go @@ -109,11 +109,6 @@ func (t *Test) willRun() bool { // finalize runs all the Test's registered finalizers. // Failures encountered executing finalizers will fail the Test. func (t *Test) finalize() { - if t.failed && t.Context().params.PauseOnFail { - t.Log("Pausing after test failure, press the Enter key to continue:") - fmt.Scanln() - } - t.Debug("Finalizing Test", t.Name()) for _, f := range t.finalizers { From d9c680702d57489ec8f97fe0e377f4e67e5ba612 Mon Sep 17 00:00:00 2001 From: Jarno Rajahalme Date: Tue, 20 Jul 2021 12:08:49 +0300 Subject: [PATCH 2/2] test: Suppress repeated output when no flows Suppress repeated output that occurs when no flow have been received yet, i.e., the first two lines of: Validating 0 flows against 2 requirements Validating 0 flows against 2 requirements Validating 23 flows against 2 requirements Signed-off-by: Jarno Rajahalme --- connectivity/check/action.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/connectivity/check/action.go b/connectivity/check/action.go index 436a606d97..6c07bd83e7 100644 --- a/connectivity/check/action.go +++ b/connectivity/check/action.go @@ -739,6 +739,11 @@ r: // Attempt to validate all flows received during the Action so far, // once per validation interval. case <-interval.C: + if len(a.flows) == 0 { + // Suppress output like 'Validating 0 flows against 2 requirements' + // as it is futile to validate requirements when there are no flows yet. + continue r + } a.Debugf("Validating %d flows against %d requirements", len(a.flows), len(reqs)) res = a.matchAllFlowRequirements(ctx, reqs)