1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-15 18:57:01 +00:00

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 <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
Earl Warren 2025-07-15 20:23:38 +00:00 committed by earl-warren
parent 6e6ebbc981
commit 87d8366311
No known key found for this signature in database
GPG key ID: F128CBE6AB3A7201

View file

@ -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