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

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
This commit is contained in:
Earl Warren 2025-08-10 15:37:17 +02:00
parent a737f197c7
commit dcb8bfb920
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

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