Skip to content

Commit d02f3f4

Browse files
committed
add more test cases
1 parent ffba61a commit d02f3f4

File tree

2 files changed

+44
-6
lines changed

2 files changed

+44
-6
lines changed

tests/integration/actions_job_test.go

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
api "code.gitea.io/gitea/modules/structs"
1919

2020
runnerv1 "code.gitea.io/actions-proto-go/runner/v1"
21-
2221
"github.com/stretchr/testify/assert"
2322
)
2423

@@ -31,8 +30,11 @@ func TestJobWithNeeds(t *testing.T) {
3130
}{
3231
{
3332
treePath: ".gitea/workflows/job-with-needs.yml",
34-
fileContent: `name: test
35-
on: push
33+
fileContent: `name: job-with-needs
34+
on:
35+
push:
36+
paths:
37+
- '.gitea/workflows/job-with-needs.yml'
3638
jobs:
3739
job1:
3840
runs-on: ubuntu-latest
@@ -59,8 +61,11 @@ jobs:
5961
},
6062
{
6163
treePath: ".gitea/workflows/job-with-needs-fail.yml",
62-
fileContent: `name: test
63-
on: push
64+
fileContent: `name: job-with-needs-fail
65+
on:
66+
push:
67+
paths:
68+
- '.gitea/workflows/job-with-needs-fail.yml'
6469
jobs:
6570
job1:
6671
runs-on: ubuntu-latest
@@ -82,6 +87,38 @@ jobs:
8287
"job2": actions_model.StatusSkipped.String(),
8388
},
8489
},
90+
{
91+
treePath: ".gitea/workflows/job-with-needs-fail-if.yml",
92+
fileContent: `name: job-with-needs-fail-if
93+
on:
94+
push:
95+
paths:
96+
- '.gitea/workflows/job-with-needs-fail-if.yml'
97+
jobs:
98+
job1:
99+
runs-on: ubuntu-latest
100+
steps:
101+
- run: echo job1
102+
job2:
103+
runs-on: ubuntu-latest
104+
needs: [job1]
105+
if: ${{ always() }}
106+
steps:
107+
- run: echo job2
108+
`,
109+
execPolicies: map[string]*taskExecPolicy{
110+
"job1": {
111+
result: runnerv1.Result_RESULT_FAILURE,
112+
},
113+
"job2": {
114+
result: runnerv1.Result_RESULT_SUCCESS,
115+
},
116+
},
117+
expectedStatuses: map[string]string{
118+
"job1": actions_model.StatusFailure.String(),
119+
"job2": actions_model.StatusSuccess.String(),
120+
},
121+
},
85122
}
86123
onGiteaRun(t, func(t *testing.T, u *url.URL) {
87124
runner := newMockRunner(t)
@@ -155,6 +192,8 @@ jobs:
155192
assert.Equal(t, status, tc.expectedStatuses[apiTask.Name])
156193
}
157194
}
195+
196+
// time.Sleep(30 * time.Second)
158197
})
159198
}
160199

tests/integration/actions_runner_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"code.gitea.io/actions-proto-go/ping/v1/pingv1connect"
1818
runnerv1 "code.gitea.io/actions-proto-go/runner/v1"
1919
"code.gitea.io/actions-proto-go/runner/v1/runnerv1connect"
20-
2120
"connectrpc.com/connect"
2221
"github.com/stretchr/testify/assert"
2322
"google.golang.org/protobuf/types/known/timestamppb"

0 commit comments

Comments
 (0)