Files
gitea/modelmigration/v28/v354_test.go
T
bircni 3875db1974 feat(actions): add build queue view (#38585)
Adds a read-only Actions job queue: running jobs first, then waiting
jobs in the order a runner picks them up. It is shown instance-wide in
the admin Actions section with owner, repository and status filters, and
per repository in the Actions tab. Both lists refresh in place.

Pending work is currently only visible per repository and newest-first,
so nothing shows what is queued, in which order, or what occupies the
runners. Reordering the queue will be proposed separately.

A migration adds indexes for the runner pickup query and
repository-scoped status lookups.

* Fix #34198

<img width="1345" height="451" alt="image"
src="https://github.com/user-attachments/assets/7d52ff76-81b4-44e8-b583-d7d89c9dffcd"
/>
<img width="1809" height="1134" alt="image"
src="https://github.com/user-attachments/assets/4d56c0cb-bae7-4ce2-8f3c-75163b2bc7f4"
/>

---------

Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-26 08:01:41 +00:00

52 lines
1.2 KiB
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/assert"
"github.com/stretchr/testify/require"
)
func TestAddActionQueueIndexes(t *testing.T) {
type ActionRunJob struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64
TaskID int64
Status int
Updated int64 `xorm:"updated"`
}
type ActionRun struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64
Status int
}
x, deferable := migrationtest.PrepareTestEnv(t, 0, new(ActionRunJob), new(ActionRun))
defer deferable()
if x == nil || t.Failed() {
return
}
require.NoError(t, AddActionQueueIndexes(t.Context(), x))
tables := migrationtest.LoadTableSchemasMap(t, x)
indexCols := func(table string) [][]string {
schema, ok := tables[table]
require.True(t, ok)
var cols [][]string
for _, idx := range schema.Indexes {
cols = append(cols, idx.Cols)
}
return cols
}
assert.Contains(t, indexCols("action_run_job"), []string{"task_id", "status", "updated"})
assert.Contains(t, indexCols("action_run_job"), []string{"repo_id", "status"})
assert.Contains(t, indexCols("action_run"), []string{"repo_id", "status"})
}