fix: Adjust the tests

Signed-off-by: Pascal Zimmermann <pascal.zimmermann@theiotstudio.com>
This commit is contained in:
Pascal Zimmermann
2026-02-16 20:20:15 +01:00
parent e43fe47fb0
commit 9b0eedd3f1
3 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -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)
+3 -3
View File
@@ -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")
+2 -1
View File
@@ -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
}