mirror of
https://github.com/go-gitea/gitea
synced 2025-12-07 13:28:25 +00:00
#35783 fixes an actions rerun bug. Due to this bug, some runs may be incorrectly marked as `StatusWaiting` even though all the jobs are in done status. These runs cannot be run or cancelled. This PR adds a new doctor command to fix the inconsistent run status. ``` gitea doctor check --run fix-actions-unfinished-run-status --fix ``` Thanks to @ChristopherHX for the test.
25 lines
650 B
Go
25 lines
650 B
Go
// Copyright 2025 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package doctor
|
|
|
|
import (
|
|
"testing"
|
|
|
|
actions_model "code.gitea.io/gitea/models/actions"
|
|
"code.gitea.io/gitea/models/unittest"
|
|
"code.gitea.io/gitea/modules/log"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func Test_fixUnfinishedRunStatus(t *testing.T) {
|
|
assert.NoError(t, unittest.PrepareTestDatabase())
|
|
|
|
fixUnfinishedRunStatus(t.Context(), log.GetLogger(log.DEFAULT), true)
|
|
|
|
// check if the run is cancelled by id
|
|
run := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{ID: 805})
|
|
assert.Equal(t, actions_model.StatusCancelled, run.Status)
|
|
}
|