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:
parent
a737f197c7
commit
dcb8bfb920
1 changed files with 8 additions and 4 deletions
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue