[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 <git@olivier.pfad.fr>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8848
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
forgejo-backport-action 2025-08-10 15:14:06 +02:00 committed by Earl Warren
commit a5e342d827
2 changed files with 10 additions and 1 deletions

View file

@ -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

View file

@ -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)