From 3a990105d5a55184fe76f72d3d1c0f4c332e0ad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20Suszy=C5=84ski?= Date: Thu, 18 Jul 2024 14:06:21 +0200 Subject: [PATCH] Relaxing checks for stderr to not fail on download lines --- test/unit/presubmit_test.go | 2 +- test/unit/report_go_test.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/unit/presubmit_test.go b/test/unit/presubmit_test.go index af5904fc..d4f4c961 100644 --- a/test/unit/presubmit_test.go +++ b/test/unit/presubmit_test.go @@ -38,7 +38,7 @@ func TestPresubmitTestMainFunc(t *testing.T) { contains("Unit tests for knative.dev/hack/schema"), contains("Unit tests for knative.dev/hack"), contains("Running go test with args: -short -race -count 1 ./..."), - contains("go run gotest.tools/gotestsum@v1.11.0 --format testname --junitfile"), + contains("👻 go run gotest.tools/gotestsum@v1.11.0 --format testname --junitfile"), contains("-- -short -race -count 1 ./..."), header("UNIT TESTS PASSED"), }, diff --git a/test/unit/report_go_test.go b/test/unit/report_go_test.go index 09dcf1ca..e042c630 100644 --- a/test/unit/report_go_test.go +++ b/test/unit/report_go_test.go @@ -29,7 +29,7 @@ func TestReportGoTest(t *testing.T) { contains("fatal\tTestFailsWithFatal\tlibrary_test.go:48\tFailed with logger.Fatal()"), contains("FAIL test.TestFailsWithFatal"), }, logChecks...), - stderr: lines("exit status 1"), + stderr: []check{contains("exit status 1")}, }, { name: `report_go_test -tags=library -run TestFailsWithPanic ./test`, stdout: append([]check{ @@ -37,7 +37,7 @@ func TestReportGoTest(t *testing.T) { contains("panic: test timed out after 5m0s"), contains("FAIL test.TestFailsWithPanic"), }, logChecks...), - stderr: lines("exit status 1"), + stderr: []check{contains("exit status 1")}, }, { name: `report_go_test -tags=library -run TestFailsWithSigQuit ./test`, stdout: append([]check{ @@ -45,10 +45,10 @@ func TestReportGoTest(t *testing.T) { contains("SIGQUIT: quit"), contains("FAIL test.TestFailsWithSigQuit"), }, logChecks...), - stderr: lines("exit status 1"), + stderr: []check{contains("exit status 1")}, }} - for _, tc := range tcs { - tc := tc + for i := range tcs { + tc := tcs[i] t.Run(tc.name, tc.test(sc)) } }