-
Notifications
You must be signed in to change notification settings - Fork 5
241 lines (240 loc) · 8.99 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
on: push
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@2.0.0
with:
scandir: './steps'
- name: Install faketime
run: |
sudo apt-get update
sudo apt-get install libfaketime
- name: Base case command
id: test_base
uses: ./
env:
LD_PRELOAD: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
FAKETIME: '2021-12-31 23:59:59'
with:
token: test_token
run_group_id: 42
dry_run: true
- name: Base case test
uses: ./.github/actions/test
with:
actual: ${{ steps.test_base.outputs.command }}
expected: run --skip-update --token "test_token" --run-group 42 --junit-file results/rainforest/junit.xml --save-run-id .rainforest_run_id --description "rainforestapp/github-action - ${{ github.ref_name }} test 2021-12-31T23:59:59Z" --release "${{ github.sha }}"
- name: All parameters command
id: test_all_parameters
uses: ./
with:
token: test_token
run_group_id: 42
description: foo bar
environment_id: 117
conflict: cancel-all
execution_method: automation
release: '1.0'
automation_max_retries: 2
background: true
dry_run: true
- name: All parameters test
uses: ./.github/actions/test
with:
actual: ${{ steps.test_all_parameters.outputs.command }}
expected: run --skip-update --token "test_token" --run-group 42 --junit-file results/rainforest/junit.xml --save-run-id .rainforest_run_id --conflict cancel-all --environment-id 117 --execution-method automation --automation-max-retries 2 --description "foo bar" --release "1.0" --background
- name: Custom URL command
id: test_custom_url
uses: ./
with:
token: test_token
run_group_id: 42
description: foo bar
custom_url: https://something.com
release: '1.0'
dry_run: true
- name: Custom URL test
uses: ./.github/actions/test
with:
actual: ${{ steps.test_custom_url.outputs.command }}
expected: run --skip-update --token "test_token" --run-group 42 --junit-file results/rainforest/junit.xml --save-run-id .rainforest_run_id --custom-url "https://something.com" --description "foo bar" --release "1.0"
- name: Environment ID and Custom URL command
id: test_environment_id_custom_url
uses: ./
with:
token: test_token
run_group_id: 42
description: foo bar
environment_id: 117
custom_url: https://something.com
release: '1.0'
dry_run: true
- name: Environment ID and Custom URL test
uses: ./.github/actions/test
with:
actual: ${{ steps.test_environment_id_custom_url.outputs.command }}
expected: run --skip-update --token "test_token" --run-group 42 --junit-file results/rainforest/junit.xml --save-run-id .rainforest_run_id --custom-url "https://something.com" --description "foo bar" --release "1.0"
- name: Branch command
id: test_branch
uses: ./
with:
token: test_token
run_group_id: 42
description: foo bar
branch: feature-branch
release: '1.0'
dry_run: true
- name: Branch test
uses: ./.github/actions/test
with:
actual: ${{ steps.test_branch.outputs.command }}
expected: run --skip-update --token "test_token" --run-group 42 --junit-file results/rainforest/junit.xml --save-run-id .rainforest_run_id --branch "feature-branch" --description "foo bar" --release "1.0"
- name: Quoted parameters command
id: test_quoted_parameters
uses: ./
with:
token: test_token
run_group_id: 42
description: something"exit 1
branch: some name"exit 2
release: some sha"exit 3
dry_run: true
- name: Quoted parameters test
uses: ./.github/actions/test
with:
actual: ${{ steps.test_quoted_parameters.outputs.command }}
expected: run --skip-update --token "test_token" --run-group 42 --junit-file results/rainforest/junit.xml --save-run-id .rainforest_run_id --branch "some name\"exit 2" --description "something\"exit 1" --release "some sha\"exit 3"
- name: Missing token command
id: test_missing_token
uses: ./
with:
dry_run: true
continue-on-error: true
- name: Missing token test
uses: ./.github/actions/test
with:
actual: ${{ steps.test_missing_token.outputs.error }}
expected: Token not set
- name: Invalid run group command
id: test_invalid_run_group
uses: ./
with:
token: test_token
run_group_id: nike
dry_run: true
continue-on-error: true
- name: Invalid run group test
uses: ./.github/actions/test
with:
actual: ${{ steps.test_invalid_run_group.outputs.error }}
expected: run_group_id not a positive integer (nike)
- name: Invalid environment ID command
id: test_invalid_environment_id
uses: ./
with:
token: test_token
run_group_id: 42
environment_id: hostile
dry_run: true
continue-on-error: true
- name: Invalid environment ID test
uses: ./.github/actions/test
with:
actual: ${{ steps.test_invalid_environment_id.outputs.error }}
expected: environment_id not a positive integer (hostile)
- name: Invalid conflict command
id: test_invalid_conflict
uses: ./
with:
token: test_token
run_group_id: 42
conflict: WWIII
dry_run: true
continue-on-error: true
- name: Invalid conflict test
uses: ./.github/actions/test
with:
actual: ${{ steps.test_invalid_conflict.outputs.error }}
expected: WWIII not in (cancel cancel-all)
- name: Invalid execution_method command
id: test_invalid_execution_method
uses: ./
with:
token: test_token
run_group_id: 42
execution_method: sarlacc_pit
dry_run: true
continue-on-error: true
- name: Invalid execution_method test
uses: ./.github/actions/test
with:
actual: ${{ steps.test_invalid_execution_method.outputs.error }}
expected: sarlacc_pit not in (automation crowd automation_and_crowd on_premise)
- name: Invalid crowd command
id: test_invalid_crowd
uses: ./
with:
token: test_token
run_group_id: 42
crowd: hipsters
dry_run: true
continue-on-error: true
- name: Invalid crowd test
uses: ./.github/actions/test
with:
actual: ${{ steps.test_invalid_crowd.outputs.error }}
expected: hipsters not in (default automation automation_and_crowd on_premise_crowd)
- name: Invalid automation max retries command
id: test_invalid_automation_max_retries
uses: ./
with:
token: test_token
run_group_id: 42
automation_max_retries: infinite
dry_run: true
continue-on-error: true
- name: Invalid automation max retries test
uses: ./.github/actions/test
with:
actual: ${{ steps.test_invalid_automation_max_retries.outputs.error }}
expected: automation_max_retries not a positive integer (infinite)
- name: Invalid parameter generic test
uses: ./.github/actions/test
with:
each: true
actual: |-
${{ steps.test_missing_token.outcome }}
${{ steps.test_invalid_run_group.outcome }}
${{ steps.test_invalid_environment_id.outcome }}
${{ steps.test_invalid_conflict.outcome }}
${{ steps.test_invalid_execution_method.outcome }}
${{ steps.test_invalid_crowd.outcome }}
${{ steps.test_invalid_automation_max_retries.outcome }}
expected: failure
- name: Rerun test setup
run: |
echo "343" > .rainforest_run_id
- name: Rerun command
id: test_rerun
uses: ./
with:
token: test_token
run_group_id: 42
environment_id: 117
description: foo bar
conflict: cancel
execution_method: automation
release: '1.0'
background: true
dry_run: true
- name: Rerun test
uses: ./.github/actions/test
with:
actual: ${{ steps.test_rerun.outputs.command }}
expected: rerun "343" --skip-update --token "test_token" --junit-file results/rainforest/junit.xml --save-run-id .rainforest_run_id --conflict cancel --release "1.0" --background