From 87d836631191393964a8abf75e1e407e1289f42b Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Tue, 15 Jul 2025 20:23:38 +0000 Subject: [PATCH] chore(tests): reporter.SetOutputs tests have side effects [skip cascade] (#701) testutils.MockVariable must be in a defer to restore the previous value. Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/701 Reviewed-by: Michael Kriese Co-authored-by: Earl Warren Co-committed-by: Earl Warren --- internal/pkg/report/reporter_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/pkg/report/reporter_test.go b/internal/pkg/report/reporter_test.go index ffa58f61..2cde55ce 100644 --- a/internal/pkg/report/reporter_test.go +++ b/internal/pkg/report/reporter_test.go @@ -84,8 +84,8 @@ func TestReporterSetOutputs(t *testing.T) { t.Run("IgnoreTooBig", func(t *testing.T) { reporter, _, _ := mockReporter(t) - testutils.MockVariable(&outputKeyMaxLength, 5) - testutils.MockVariable(&outputValueMaxLength, 5) + defer testutils.MockVariable(&outputKeyMaxLength, 5)() + defer testutils.MockVariable(&outputValueMaxLength, 5)() in := map[string]string{ "0123456": "b", // key too big