From 6d76cb998dc6271b448ae53e044c569b48607f47 Mon Sep 17 00:00:00 2001 From: David Simansky Date: Mon, 17 Aug 2026 11:55:55 +0200 Subject: [PATCH] fix: Fix flaky logging test --- pkg/output/logging/context_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/output/logging/context_test.go b/pkg/output/logging/context_test.go index f928c8853b..1cc901f063 100644 --- a/pkg/output/logging/context_test.go +++ b/pkg/output/logging/context_test.go @@ -18,6 +18,7 @@ package logging_test import ( "errors" + "regexp" "testing" "knative.dev/client/pkg/context" @@ -50,9 +51,9 @@ func TestEnsureLoggerWithoutTestingT(t *testing.T) { l.Debug("test") out := printer.Outputs() got := out.Err.String() - want := "0 \x1b[35mDEBUG\x1b[0m test\n" - if got != want { - t.Errorf("\nwant %q,\n got %q", want, got) + want := regexp.MustCompile(`^\d+ \x1b\[35mDEBUG\x1b\[0m test\n$`) + if !want.MatchString(got) { + t.Errorf("\nwant match %q,\n got %q", want, got) } }