From 0df49542b154b8b34bba5f25f181064830bcdbb3 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Tue, 13 Dec 2022 15:29:18 +0100 Subject: [PATCH] e2e framework: fix unit test flake The Gingo v2 time suffix is hh:mm:ss without the .xyz sub-second details if the time stamp happens to land exactly on a second. This change fixes test flakes like the following: -STEP: Building a namespace api object, basename test-namespace +STEP: Building a namespace api object, basename test-namespace 12/13/22 11:43:53 --- FAIL: TestCleanup (36.79s) --- test/e2e/framework/internal/output/output.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/framework/internal/output/output.go b/test/e2e/framework/internal/output/output.go index 54d28bda574..cb70e9cd912 100644 --- a/test/e2e/framework/internal/output/output.go +++ b/test/e2e/framework/internal/output/output.go @@ -104,7 +104,7 @@ var timePrefix = regexp.MustCompile(`(?m)^[[:alpha:]]{3} +[[:digit:]]{1,2} +[[:d var elapsedSuffix = regexp.MustCompile(`Elapsed: [[:digit:]]+(\.[[:digit:]]+)?(µs|ns|ms|s|m)`) // timeSuffix matches "09/06/22 15:36:43.445" as printed by Ginkgo v2 for log output. -var timeSuffix = regexp.MustCompile(`(?m)[[:space:]][[:digit:]]{2}/[[:digit:]]{2}/[[:digit:]]{2} [[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}\.[[:digit:]]{1,3}$`) +var timeSuffix = regexp.MustCompile(`(?m)[[:space:]][[:digit:]]{2}/[[:digit:]]{2}/[[:digit:]]{2} [[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}(\.[[:digit:]]{1,3})?$`) func stripTimes(in string) string { out := timePrefix.ReplaceAllString(in, "")