Skip to content

Commit aac47fa

Browse files
committed
add test
1 parent 608f2b3 commit aac47fa

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

services/actions/job_emitter_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,24 @@ func Test_jobStatusResolver_Resolve(t *testing.T) {
7070
},
7171
want: map[int64]actions_model.Status{},
7272
},
73+
{
74+
name: "with always() condition",
75+
jobs: actions_model.ActionJobList{
76+
{ID: 1, JobID: "job1", Status: actions_model.StatusFailure, Needs: []string{}},
77+
{ID: 2, JobID: "job2", Status: actions_model.StatusBlocked, Needs: []string{"job1"}, WorkflowPayload: []byte(
78+
"name: test\non: push\njobs:\n job2:\n runs-on: ubuntu-latest\n needs: job1\n if: ${{ always() }}\n steps:\n - run: echo \"always run\"")},
79+
},
80+
want: map[int64]actions_model.Status{2: actions_model.StatusWaiting},
81+
},
82+
{
83+
name: "without always() condition",
84+
jobs: actions_model.ActionJobList{
85+
{ID: 1, JobID: "job1", Status: actions_model.StatusFailure, Needs: []string{}},
86+
{ID: 2, JobID: "job2", Status: actions_model.StatusBlocked, Needs: []string{"job1"}, WorkflowPayload: []byte(
87+
"name: test\non: push\njobs:\n job2:\n runs-on: ubuntu-latest\n needs: job1\n steps:\n - run: echo \"always run\"")},
88+
},
89+
want: map[int64]actions_model.Status{2: actions_model.StatusSkipped},
90+
},
7391
}
7492
for _, tt := range tests {
7593
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)