Some checks failed
cache-seeder / prune (push) Has been skipped
cache-seeder / frontend (push) Failing after 3s
cache-seeder / python (push) Failing after 3s
cache-seeder / gobuild (push) Failing after 4s
cache-seeder / lint (bindata, lint-backend) (push) Failing after 3s
giteabot backport / giteabot (push) Has been skipped
giteabot / giteabot (push) Has been skipped
cache-prune / prune (push) Has been skipped
release-nightly-snapcraft / build-and-publish (ubuntu-24.04) (push) Has been cancelled
release-nightly-snapcraft / build-and-publish (ubuntu-24.04-arm) (push) Has been cancelled
release-nightly / nightly-binary (push) Has been cancelled
release-nightly / nightly-container (push) Has been cancelled
cron-renovate / cron-renovate (push) Has been skipped
38 lines
890 B
Go
38 lines
890 B
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package v28
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gitea.dev/modelmigration/migrationtest"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestAddMaxParallelToActionRunJob(t *testing.T) {
|
|
type ActionRunJob struct {
|
|
ID int64 `xorm:"pk autoincr"`
|
|
Name string `xorm:"VARCHAR(255)"`
|
|
}
|
|
|
|
x, deferable := migrationtest.PrepareTestEnv(t, 0, new(ActionRunJob))
|
|
defer deferable()
|
|
if x == nil || t.Failed() {
|
|
return
|
|
}
|
|
|
|
_, err := x.Insert(&ActionRunJob{Name: "job-a"})
|
|
require.NoError(t, err)
|
|
|
|
require.NoError(t, AddMaxParallelToActionRunJob(t.Context(), x))
|
|
|
|
// pre-existing rows must default to unlimited
|
|
var maxParallel int
|
|
has, err := x.SQL("SELECT max_parallel FROM action_run_job WHERE id = ?", 1).Get(&maxParallel)
|
|
require.NoError(t, err)
|
|
require.True(t, has)
|
|
require.Equal(t, 0, maxParallel)
|
|
}
|