
A regression was introduced in Forgejo v11.0 that caused the edit page of a runner (e.g. https://example.org/admin/actions/runners/434) to no longer display the tasks associated with the runner. Fixes https://codeberg.org/forgejo/forgejo/issues/7643 --- When the fix is absent, the tests fail like so: ``` --- FAIL: TestRunnerDetails (0.03s) --- FAIL: TestRunnerDetails/first_page (0.00s) runners_test.go:36: Error Trace: /home/earl-warren/software/forgejo/routers/web/shared/actions/runners_test.go:36 Error: "[]" should have 30 item(s), but has 0 Test: TestRunnerDetails/first_page --- FAIL: TestRunnerDetails/second_and_last_page (0.00s) runners_test.go:43: Error Trace: /home/earl-warren/software/forgejo/routers/web/shared/actions/runners_test.go:43 Error: "[]" should have 10 item(s), but has 0 Test: TestRunnerDetails/second_and_last_page FAIL FAIL forgejo.org/routers/web/shared/actions 0.170s ``` ## Checklist The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org). ### Tests - I added test coverage for Go changes... - [x] in their respective `*_test.go` for unit tests. - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - I added test coverage for JavaScript changes... - [ ] in `web_src/js/*.test.js` if it can be unit tested. - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)). ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [ ] I do not want this change to show in the release notes. - [x] I want the title to show in the release notes with a link to this pull request. - [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title. <!--start release-notes-assistant--> ## Release notes <!--URL:https://codeberg.org/forgejo/forgejo--> - User Interface bug fixes - [PR](https://codeberg.org/forgejo/forgejo/pulls/7650): <!--number 7650 --><!--line 0 --><!--description ZGlzcGxheSB0aGUgbGlzdCBvZiB0YXNrcyBpbiB0aGUgcnVubmVyIGVkaXQgcGFnZQ==-->display the list of tasks in the runner edit page<!--description--> <!--end release-notes-assistant--> <!--start release-notes-assistant--> ## Release notes <!--URL:https://codeberg.org/forgejo/forgejo--> - User Interface bug fixes - [PR](https://codeberg.org/forgejo/forgejo/pulls/7650): <!--number 7650 --><!--line 0 --><!--description ZGlzcGxheSB0aGUgbGlzdCBvZiB0YXNrcyBpbiB0aGUgcnVubmVyIGVkaXQgcGFnZQ==-->display the list of tasks in the runner edit page<!--description--> <!--end release-notes-assistant--> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7650 Reviewed-by: cobak78 <cobak78@noreply.codeberg.org> Co-authored-by: Earl Warren <contact@earl-warren.org> Co-committed-by: Earl Warren <contact@earl-warren.org>
47 lines
1.4 KiB
Go
47 lines
1.4 KiB
Go
// Copyright 2025 The Forgejo Authors.
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package actions
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
|
|
actions_model "forgejo.org/models/actions"
|
|
"forgejo.org/models/unittest"
|
|
user_model "forgejo.org/models/user"
|
|
"forgejo.org/services/contexttest"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestRunnerDetails(t *testing.T) {
|
|
defer unittest.OverrideFixtures("routers/web/shared/actions/fixtures/TestRunnerDetails")()
|
|
require.NoError(t, unittest.PrepareTestDatabase())
|
|
|
|
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
|
|
runner := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRunner{ID: 1004})
|
|
|
|
t.Run("permission denied", func(t *testing.T) {
|
|
ctx, resp := contexttest.MockContext(t, "/admin/actions/runners")
|
|
RunnerDetails(ctx, 1, runner.ID, user.ID, 0)
|
|
assert.Equal(t, http.StatusNotFound, resp.Code)
|
|
})
|
|
|
|
t.Run("first page", func(t *testing.T) {
|
|
ctx, resp := contexttest.MockContext(t, "/admin/actions/runners")
|
|
page := 1
|
|
RunnerDetails(ctx, page, runner.ID, 0, 0)
|
|
require.Equal(t, http.StatusOK, resp.Code)
|
|
assert.Len(t, ctx.GetData()["Tasks"], 30)
|
|
})
|
|
|
|
t.Run("second and last page", func(t *testing.T) {
|
|
ctx, resp := contexttest.MockContext(t, "/admin/actions/runners")
|
|
page := 2
|
|
RunnerDetails(ctx, page, runner.ID, 0, 0)
|
|
require.Equal(t, http.StatusOK, resp.Code)
|
|
assert.Len(t, ctx.GetData()["Tasks"], 10)
|
|
})
|
|
}
|