8000 Fix a bug in actions artifact test by Zettat123 · Pull Request #32672 · go-gitea/gitea · GitHub
[go: up one dir, main page]

Skip to content

Fix a bug in actions artifact test #32672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 29, 2024
Merged

Conversation

Zettat123
Copy link
Contributor

This bug exists in TestActionsArtifactDownload.

var listResp listArtifactsResponse
DecodeJSON(t, resp, &listResp)
assert.Equal(t, int64(2), listResp.Count)
// Return list might be in any order. Get one file.
var artifactIdx int
for i, artifact := range listResp.Value {
if artifact.Name == "artifact-download" {
artifactIdx = i
break
}
}

We assert that listResp.Count is 2, so artifactIdx could be 0 or 1.

var downloadResp downloadArtifactResponse
DecodeJSON(t, resp, &downloadResp)
assert.Len(t, downloadResp.Value, 1)
assert.Equal(t, "artifact-download/abc.txt", downloadResp.Value[artifactIdx].Path)

Then we assert that the length of downloadResp.Value is 1. If artifactIdx is 1 at this point, the assertion on Line 147 will throw an index out of range error.

* giteaofficial/main:
  Split mail sender sub package from mailer service package (go-gitea#32618)
  Fix a bug in actions artifact test (go-gitea#32672)
  Move GetFeeds to service layer (go-gitea#32526)
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Feb 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code type/testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0