Skip to content

Commit c6f1557

Browse files
committed
fix tests
1 parent f4b0811 commit c6f1557

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

models/fixtures/action_artifact.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
run_id: 791
44
runner_id: 1
55
repo_id: 4
6-
owner_id: 1
6+
owner_id: 5
77
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
88
storage_path: "26/1/1712166500347189545.chunk"
99
file_size: 1024
@@ -21,7 +21,7 @@
2121
run_id: 791
2222
runner_id: 1
2323
repo_id: 4
24-
owner_id: 1
24+
owner_id: 5
2525
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
2626
storage_path: "26/19/1712348022422036662.chunk"
2727
file_size: 1024
@@ -39,7 +39,7 @@
3939
run_id: 791
4040
runner_id: 1
4141
repo_id: 4
42-
owner_id: 1
42+
owner_id: 5
4343
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
4444
storage_path: "26/20/1712348022423431524.chunk"
4545
file_size: 1024
@@ -57,7 +57,7 @@
5757
run_id: 792
5858
runner_id: 1
5959
repo_id: 4
60-
owner_id: 1
60+
owner_id: 5
6161
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
6262
storage_path: "27/5/1730330775594233150.chunk"
6363
file_size: 1024

models/fixtures/action_run_job.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
id: 192
33
run_id: 791
44
repo_id: 4
5-
owner_id: 1
5+
owner_id: 5
66
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
77
is_fork_pull_request: 0
88
name: job_2
@@ -16,7 +16,7 @@
1616
id: 193
1717
run_id: 792
1818
repo_id: 4
19-
owner_id: 1
19+
owner_id: 5
2020
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
2121
is_fork_pull_request: 0
2222
name: job_2
@@ -30,7 +30,7 @@
3030
id: 194
3131
run_id: 793
3232
repo_id: 4
33-
owner_id: 1
33+
owner_id: 5
3434
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
3535
is_fork_pull_request: 0
3636
name: job1 (1)
@@ -44,7 +44,7 @@
4444
id: 195
4545
run_id: 793
4646
repo_id: 4
47-
owner_id: 1
47+
owner_id: 5
4848
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
4949
is_fork_pull_request: 0
5050
name: job1 (2)
@@ -58,7 +58,7 @@
5858
id: 196
5959
run_id: 793
6060
repo_id: 4
61-
owner_id: 1
61+
owner_id: 5
6262
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
6363
is_fork_pull_request: 0
6464
name: job2

routers/api/v1/repo/action.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,7 @@ func DownloadArtifactRaw(ctx *context.APIContext) {
866866
ctx.Error(http.StatusInternalServerError, err.Error(), err)
867867
return
868868
}
869+
return
869870
}
870871
// v3 not supported due to not having one unique id
871872
ctx.Error(http.StatusNotFound, "artifact not found", fmt.Errorf("artifact not found"))

tests/integration/api_actions_artifact_v4_test.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ func TestActionsArtifactV4RunDownloadSinglePublicApi(t *testing.T) {
351351
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
352352

353353
// confirm artifact upload via rest api
354-
req := NewRequestWithBody(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/run/792/artifacts?name=artifact-v4-download", repo.FullName()), nil).
354+
req := NewRequestWithBody(t, "GET", fmt.Sprintf("/api/v1/repos/%s/actions/runs/792/artifacts?name=artifact-v4-download", repo.FullName()), nil).
355355
AddTokenAuth(token)
356356
resp := MakeRequest(t, req, http.StatusOK)
357357
var listResp api.ActionArtifactsResponse
@@ -363,7 +363,12 @@ func TestActionsArtifactV4RunDownloadSinglePublicApi(t *testing.T) {
363363
req = NewRequestWithBody(t, "GET", listResp.Entries[0].ArchiveDownloadURL, nil).
364364
AddTokenAuth(token)
365365

366+
resp = MakeRequest(t, req, http.StatusFound)
367+
368+
req = NewRequestWithBody(t, "GET", resp.Header().Get("Location"), nil).
369+
AddTokenAuth(token)
366370
resp = MakeRequest(t, req, http.StatusOK)
371+
367372
body := strings.Repeat("D", 1024)
368373
assert.Equal(t, body, resp.Body.String())
369374
}
@@ -389,6 +394,10 @@ func TestActionsArtifactV4DownloadSinglePublicApi(t *testing.T) {
389394
req = NewRequestWithBody(t, "GET", listResp.Entries[0].ArchiveDownloadURL, nil).
390395
AddTokenAuth(token)
391396

397+
resp = MakeRequest(t, req, http.StatusFound)
398+
399+
req = NewRequestWithBody(t, "GET", resp.Header().Get("Location"), nil).
400+
AddTokenAuth(token)
392401
resp = MakeRequest(t, req, http.StatusOK)
393402
body := strings.Repeat("D", 1024)
394403
assert.Equal(t, body, resp.Body.String())
@@ -411,8 +420,8 @@ func TestActionsArtifactV4ListAndGetPublicApi(t *testing.T) {
411420
assert.NoError(t, err)
412421

413422
for _, artifact := range listResp.Entries {
414-
assert.Contains(t, fmt.Sprintf("/api/v1/repos/%s/actions/artifacts/%d", repo.FullName(), artifact.ID), artifact.URL)
415-
assert.Contains(t, fmt.Sprintf("/api/v1/repos/%s/actions/artifacts/%d/zip", repo.FullName(), artifact.ID), artifact.ArchiveDownloadURL)
423+
assert.Contains(t, artifact.URL, fmt.Sprintf("/api/v1/repos/%s/actions/artifacts/%d", repo.FullName(), artifact.ID))
424+
assert.Contains(t, artifact.ArchiveDownloadURL, fmt.Sprintf("/api/v1/repos/%s/actions/artifacts/%d/zip", repo.FullName(), artifact.ID))
416425
req = NewRequestWithBody(t, "GET", listResp.Entries[0].URL, nil).
417426
AddTokenAuth(token)
418427

0 commit comments

Comments
 (0)