From a5e342d82766b6aef6b66ca11e280ad5c664f745 Mon Sep 17 00:00:00 2001 From: forgejo-backport-action Date: Sun, 10 Aug 2025 15:14:06 +0200 Subject: [PATCH] [v11.0/forgejo] fix(test): TestActionsArtifactOverwrite needs ordered query for pgsql (#8848) **Backport:** https://codeberg.org/forgejo/forgejo/pulls/8847 Should fix failures like: https://codeberg.org/forgejo/forgejo/actions/runs/94872/jobs/9 ### Documentation - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [x] I do not want this change to show in the release notes. Co-authored-by: oliverpool Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8848 Co-authored-by: forgejo-backport-action Co-committed-by: forgejo-backport-action --- models/actions/artifact.go | 7 +++++++ tests/integration/api_actions_artifact_test.go | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/models/actions/artifact.go b/models/actions/artifact.go index 10cd3868a1..95c4bead8f 100644 --- a/models/actions/artifact.go +++ b/models/actions/artifact.go @@ -132,6 +132,13 @@ func (opts FindArtifactsOptions) ToConds() builder.Cond { return cond } +var _ db.FindOptionsOrder = FindArtifactsOptions{} + +// ToOrders implements db.FindOptionsOrder, to have a stable order +func (opts FindArtifactsOptions) ToOrders() string { + return "id" +} + // ActionArtifactMeta is the meta data of an artifact type ActionArtifactMeta struct { ArtifactName string diff --git a/tests/integration/api_actions_artifact_test.go b/tests/integration/api_actions_artifact_test.go index dc2b86d28b..27cab8732e 100644 --- a/tests/integration/api_actions_artifact_test.go +++ b/tests/integration/api_actions_artifact_test.go @@ -316,8 +316,10 @@ func TestActionsArtifactOverwrite(t *testing.T) { var listResp listArtifactsResponse DecodeJSON(t, resp, &listResp) + const itemName = "artifact-download" + assert.Equal(t, itemName, listResp.Value[0].Name) idx := strings.Index(listResp.Value[0].FileContainerResourceURL, "/api/actions_pipeline/_apis/pipelines/") - url := listResp.Value[0].FileContainerResourceURL[idx+1:] + "?itemPath=artifact-download" + url := listResp.Value[0].FileContainerResourceURL[idx+1:] + "?itemPath=" + itemName req = NewRequest(t, "GET", url). AddTokenAuth("8061e833a55f6fc0157c98b883e91fcfeeb1a71a") resp = MakeRequest(t, req, http.StatusOK)