From 9b0eedd3f1117f6bce69bf21ab162653dd9bcb3c Mon Sep 17 00:00:00 2001 From: Pascal Zimmermann Date: Mon, 16 Feb 2026 20:20:15 +0100 Subject: [PATCH] fix: Adjust the tests Signed-off-by: Pascal Zimmermann --- modules/structs/issue_test.go | 2 +- tests/integration/actions_job_test.go | 6 +++--- tests/integration/actions_runner_test.go | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/structs/issue_test.go b/modules/structs/issue_test.go index 0ad05c159a..d53077a151 100644 --- a/modules/structs/issue_test.go +++ b/modules/structs/issue_test.go @@ -95,7 +95,7 @@ labels: t.Run(tt.name, func(t *testing.T) { err := yaml.Unmarshal([]byte(tt.content), tt.tmpl) if tt.wantErr != "" { - assert.EqualError(t, err, tt.wantErr) + assert.ErrorContains(t, err, tt.wantErr) } else { assert.NoError(t, err) assert.Equal(t, tt.want, tt.tmpl) diff --git a/tests/integration/actions_job_test.go b/tests/integration/actions_job_test.go index d0cb3de1d6..34452b4227 100644 --- a/tests/integration/actions_job_test.go +++ b/tests/integration/actions_job_test.go @@ -709,8 +709,8 @@ jobs: opts := getWorkflowCreateFileOptions(user2, apiRepo.DefaultBranch, "create "+tc.treePath, tc.fileContent) createWorkflowFile(t, token, user2.Name, apiRepo.Name, tc.treePath, opts) - // Execute the generate job first - task := runner.fetchTask(t) + // Execute the generate job first (use longer timeout for CI environments) + task := runner.fetchTask(t, 10*time.Second) jobName := getTaskJobNameByTaskID(t, token, user2.Name, apiRepo.Name, task.Id) assert.Equal(t, "generate", jobName) outcome := tc.outcomes[jobName] @@ -721,7 +721,7 @@ jobs: // We expect 3 tasks for build (1), build (2), build (3) buildTasks := make([]int64, 0) for range 3 { - buildTask := runner.fetchTask(t) + buildTask := runner.fetchTask(t, 10*time.Second) buildJobName := getTaskJobNameByTaskID(t, token, user2.Name, apiRepo.Name, buildTask.Id) t.Logf("Fetched task: %s", buildJobName) assert.Contains(t, []string{"build (1)", "build (2)", "build (3)"}, buildJobName, "Expected a build job with matrix index") diff --git a/tests/integration/actions_runner_test.go b/tests/integration/actions_runner_test.go index c0ed1e6644..62eb2991b6 100644 --- a/tests/integration/actions_runner_test.go +++ b/tests/integration/actions_runner_test.go @@ -12,6 +12,7 @@ import ( auth_model "code.gitea.io/gitea/models/auth" "code.gitea.io/gitea/modules/setting" + "github.com/stretchr/testify/require" pingv1 "code.gitea.io/actions-proto-go/ping/v1" "code.gitea.io/actions-proto-go/ping/v1/pingv1connect" @@ -94,7 +95,7 @@ func (r *mockRunner) registerAsRepoRunner(t *testing.T, ownerName, repoName, run func (r *mockRunner) fetchTask(t *testing.T, timeout ...time.Duration) *runnerv1.Task { task := r.tryFetchTask(t, timeout...) - assert.NotNil(t, task, "failed to fetch a task") + require.NotNil(t, task, "failed to fetch a task") return task }