File tree Expand file tree Collapse file tree 6 files changed +184
-0
lines changed
routers/api/actions/runner Expand file tree Collapse file tree 6 files changed +184
-0
lines changed Original file line number Diff line number Diff line change 3636 updated : 1683636626
3737 need_approval : 0
3838 approved_by : 0
39+ -
40+ id : 793
41+ title : " job output"
42+ repo_id : 4
43+ owner_id : 1
44+ workflow_id : " test.yaml"
45+ index : 189
46+ trigger_user_id : 1
47+ ref : " refs/heads/master"
48+ commit_sha : " c2d72f548424103f01ee1dc02889c1e2bff816b0"
49+ event : " push"
50+ is_fork_pull_request : 0
51+ status : 1
52+ started : 1683636528
53+ stopped : 1683636626
54+ created : 1683636108
55+ updated : 1683636626
56+ need_approval : 0
57+ approved_by : 0
Original file line number Diff line number Diff line change 2626 status : 1
2727 started : 1683636528
2828 stopped : 1683636626
29+ -
30+ id : 194
31+ run_id : 793
32+ repo_id : 4
33+ owner_id : 1
34+ commit_sha : c2d72f548424103f01ee1dc02889c1e2bff816b0
35+ is_fork_pull_request : 0
36+ name : job1 (1)
37+ attempt : 1
38+ job_id : job1
39+ task_id : 49
40+ status : 1
41+ started : 1683636528
42+ stopped : 1683636626
43+ -
44+ id : 195
45+ run_id : 793
46+ repo_id : 4
47+ owner_id : 1
48+ commit_sha : c2d72f548424103f01ee1dc02889c1e2bff816b0
49+ is_fork_pull_request : 0
50+ name : job1 (2)
51+ attempt : 1
52+ job_id : job1
53+ task_id : 50
54+ status : 1
55+ started : 1683636528
56+ stopped : 1683636626
57+ -
58+ id : 196
59+ run_id : 793
60+ repo_id : 4
61+ owner_id : 1
62+ commit_sha : c2d72f548424103f01ee1dc02889c1e2bff816b0
63+ is_fork_pull_request : 0
64+ name : job2
65+ attempt : 1
66+ job_id : job2
67+ needs : [job1]
68+ task_id : 51
69+ status : 5
70+ started : 1683636528
71+ stopped : 1683636626
Original file line number Diff line number Diff line change 5757 log_length : 707
5858 log_size : 90179
5959 log_expired : 0
60+ -
61+ id : 49
62+ job_id : 194
63+ attempt : 1
64+ runner_id : 1
65+ status : 1 # success
66+ started : 1683636528
67+ stopped : 1683636626
68+ repo_id : 4
69+ owner_id : 1
70+ commit_sha : c2d72f548424103f01ee1dc02889c1e2bff816b0
71+ is_fork_pull_request : 0
72+ token_hash : b8d3962425466b6709b9ac51446f93260c54afe8e7b6d3686e34f991fb8a8953822b0deed86fe41a103f34bc48dbc4784220
73+ token_salt : ffffffffff
74+ token_last_eight : ffffffff
75+ log_filename : artifact-test2/2f/47.log
76+ log_in_storage : 1
77+ log_length : 707
78+ log_size : 90179
79+ log_expired : 0
80+ -
81+ id : 50
82+ job_id : 195
83+ attempt : 1
84+ runner_id : 1
85+ status : 1 # success
86+ started : 1683636528
87+ stopped : 1683636626
88+ repo_id : 4
89+ owner_id : 1
90+ commit_sha : c2d72f548424103f01ee1dc02889c1e2bff816b0
91+ is_fork_pull_request : 0
92+ token_hash : b8d3962425466b6709b9ac51446f93260c54afe8e7b6d3686e34f991fb8a8953822b0deed86fe41a103f34bc48dbc4784221
93+ token_salt : ffffffffff
94+ token_last_eight : ffffffff
95+ log_filename : artifact-test2/2f/47.log
96+ log_in_storage : 1
97+ log_length : 707
98+ log_size : 90179
99+ log_expired : 0
100+ -
101+ id : 51
102+ job_id : 196
103+ attempt : 1
104+ runner_id : 1
105+ status : 6 # running
106+ started : 1683636528
107+ stopped : 1683636626
108+ repo_id : 4
109+ owner_id : 1
110+ commit_sha : c2d72f548424103f01ee1dc02889c1e2bff816b0
111+ is_fork_pull_request : 0
112+ token_hash : b8d3962425466b6709b9ac51446f93260c54afe8e7b6d3686e34f991fb8a8953822b0deed86fe41a103f34bc48dbc4784222
113+ token_salt : ffffffffff
114+ token_last_eight : ffffffff
115+ log_filename : artifact-test2/2f/47.log
116+ log_in_storage : 1
117+ log_length : 707
118+ log_size : 90179
119+ log_expired : 0
Original file line number Diff line number Diff line change 1+ -
2+ id : 1
3+ task_id : 49
4+ output_key : output_a
5+ output_value : abc
6+ -
7+ id : 2
8+ task_id : 49
9+ output_key : output_b
10+ output_value : ' '
11+ -
12+ id : 3
13+ task_id : 50
14+ output_key : output_a
15+ output_value : ' '
16+ -
17+ id : 4
18+ task_id : 50
19+ output_key : output_b
20+ output_value : bbb
Original file line number Diff line number Diff line change 1+ // Copyright 2024 The Gitea Authors. All rights reserved.
2+ // SPDX-License-Identifier: MIT
3+
4+ package runner
5+
6+ import (
7+ "testing"
8+
9+ "code.gitea.io/gitea/models/unittest"
10+ )
11+
12+ func TestMain (m * testing.M ) {
13+ unittest .MainTest (m )
14+ }
Original file line number Diff line number Diff line change 1+ // Copyright 2024 The Gitea Authors. All rights reserved.
2+ // SPDX-License-Identifier: MIT
3+
4+ package runner
5+
6+ import (
7+ "context"
8+ "testing"
9+
10+ actions_model "code.gitea.io/gitea/models/actions"
11+ "code.gitea.io/gitea/models/unittest"
12+
13+ "github.com/stretchr/testify/assert"
14+ )
15+
16+ func Test_findTaskNeeds (t * testing.T ) {
17+ assert .NoError (t , unittest .PrepareTestDatabase ())
18+
19+ task := unittest .AssertExistsAndLoadBean (t , & actions_model.ActionTask {ID : 51 })
20+
21+ ret , err := findTaskNeeds (context .Background (), task )
22+ assert .NoError (t , err )
23+ assert .Len (t , ret , 1 )
24+ assert .Contains (t , ret , "job1" )
25+ assert .Len (t , ret ["job1" ].Outputs , 2 )
26+ assert .Equal (t , "abc" , ret ["job1" ].Outputs ["output_a" ])
27+ assert .Equal (t , "bbb" , ret ["job1" ].Outputs ["output_b" ])
28+ }
You can’t perform that action at this time.
0 commit comments