From dcb8bfb920c29678c3751b55fa6318b83adb8209 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sun, 10 Aug 2025 15:37:17 +0200 Subject: [PATCH] chore: cancel context used in CI when running workflows the context obtained from context.Background() may otherwise survive the test instead. It is equivalent to t.Context() which is only available in go >= v1.24 --- act/runner/runner_test.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/act/runner/runner_test.go b/act/runner/runner_test.go index be3dd501..86f06fcf 100644 --- a/act/runner/runner_test.go +++ b/act/runner/runner_test.go @@ -229,7 +229,8 @@ func TestRunner_RunEvent(t *testing.T) { t.Skip("skipping integration test") } - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() tables := []TestJobFileInfo{ // Shells @@ -365,7 +366,8 @@ func TestRunner_DryrunEvent(t *testing.T) { t.Skip("skipping integration test") } - ctx := common.WithDryrun(context.Background(), true) + ctx, cancel := context.WithCancel(common.WithDryrun(context.Background(), true)) + defer cancel() tables := []TestJobFileInfo{ // Shells @@ -394,7 +396,8 @@ func TestRunner_DockerActionForcePullForceRebuild(t *testing.T) { t.Skip("skipping integration test") } - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() config := &Config{ ForcePull: true, @@ -542,7 +545,8 @@ func TestRunner_RunWithService(t *testing.T) { } log.SetLevel(log.DebugLevel) - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() platforms := map[string]string{ "ubuntu-latest": "code.forgejo.org/oci/node:22",