test(run view): assert a skipped job does not cause error

Signed-off-by: Babak K. Shandiz <babakks@github.com>
This commit is contained in:
Babak K. Shandiz 2025-07-16 14:19:13 +01:00
parent 64d5d6c6c8
commit f67bd9a7d1
No known key found for this signature in database
GPG key ID: 9472CAEFF56C742E
2 changed files with 35 additions and 0 deletions

View file

@ -158,6 +158,18 @@ var LegacySuccessfulJobWithoutStepLogs Job = Job{
},
}
var SkippedJob Job = Job{
ID: 13,
Status: Completed,
Conclusion: Skipped,
Name: "cool job",
StartedAt: TestRunStartTime,
CompletedAt: TestRunStartTime,
URL: "https://github.com/jobs/13",
RunID: 3,
Steps: []Step{},
}
var FailedJob Job = Job{
ID: 20,
Status: Completed,

View file

@ -2254,6 +2254,29 @@ func TestViewRun(t *testing.T) {
wantErr: true,
errMsg: "job 20 is still in progress; logs will be available when it is complete",
},
{
name: "job log but job is skipped",
tty: false,
opts: &ViewOptions{
JobID: "13",
Log: true,
},
httpStubs: func(reg *httpmock.Registry) {
reg.Register(
httpmock.REST("GET", "repos/OWNER/REPO/actions/jobs/13"),
httpmock.JSONResponse(shared.SkippedJob))
reg.Register(
httpmock.REST("GET", "repos/OWNER/REPO/actions/runs/3"),
httpmock.JSONResponse(shared.SuccessfulRun))
reg.Register(
httpmock.REST("GET", "repos/OWNER/REPO/actions/runs/3/logs"),
httpmock.BinaryResponse(emptyZipArchive))
reg.Register(
httpmock.REST("GET", "repos/OWNER/REPO/actions/workflows/123"),
httpmock.JSONResponse(shared.TestWorkflow))
},
wantOut: "",
},
{
name: "noninteractive with job",
opts: &ViewOptions{