From c8cfc3e5e396f5f706f1afff5e8173fe7b86a2f1 Mon Sep 17 00:00:00 2001 From: Sebastian Wicki Date: Wed, 19 Jun 2024 10:11:44 +0200 Subject: [PATCH] connectivity: Display last assertion error on failure When tests have metrics expectations and those expectations are never met, we fail the test. However, the reason for the failure is never displayed unless debug logging is enabled. This commit fixes that by displaying the last assertion error when the test is failed. Signed-off-by: Sebastian Wicki --- connectivity/check/action.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connectivity/check/action.go b/connectivity/check/action.go index fff17969a7..929e3d188a 100644 --- a/connectivity/check/action.go +++ b/connectivity/check/action.go @@ -1070,7 +1070,7 @@ func (a *Action) validateMetric(ctx context.Context, node string, result Metrics select { case <-ctx.Done(): // Context timeout is reached, let's exit. - a.Failf("failed to collect metrics on node %s, context timeout: %s\n", node, ctx.Err()) + a.Failf("failed to collect metrics on node %s. context timeout: %q, last error: %s\n", node, ctx.Err(), err) return case <-ticker.C: // Ticker is delivered, let's retry.