-
Notifications
You must be signed in to change notification settings - Fork 42
/
jobs_api.feature
302 lines (273 loc) · 13 KB
/
jobs_api.feature
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
Feature: Jobs API
Scenario: Check the /api/v1/readiness response
Given System is running
When I access jobs API /api/v1/readiness
Then I should get 200 status code
Then I should receive empty JSON response
Scenario: Check the /api/v1/liveness response
Given System is running
When I access jobs API /api/v1/liveness
Then I should get 200 status code
Then I should receive empty JSON response
@jobs.requires_auth
Scenario: Check the API entry point
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I access jobs API /api/v1/service/state with authorization token
Then I should get 200 status code
Then I should receive JSON response with the state key set to running
@jobs.requires_auth
Scenario: Check the API entry point
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I read list of jobs using authorization token
Then I should get 200 status code
Then I should receive JSON response containing the jobs key
Then I should receive JSON response containing the jobs_count key
@jobs.requires_auth
Scenario: Check that job type 'all' is supported
Given System is running
When I acquire job API authorization token
When I read list of jobs with type all using authorization token
Then I should get 200 status code
Then I should see N jobs
@jobs.requires_auth
Scenario: Check that job type 'failed' is supported
Given System is running
When I acquire job API authorization token
When I read list of jobs with type failed using authorization token
Then I should get 200 status code
Then I should see N jobs
@jobs.requires_auth
Scenario: Check that job type 'user' is supported
Given System is running
When I acquire job API authorization token
When I read list of jobs with type user using authorization token
Then I should get 200 status code
Then I should see N jobs
@jobs.requires_auth
Scenario: Check that improper job type is checked
Given System is running
When I acquire job API authorization token
When I read list of jobs with type BAD using authorization token
Then I should get 400 status code
@jobs.requires_auth
Scenario: Check initial number of jobs
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I read list of jobs using authorization token
Then I should get 200 status code
Then I should see N jobs
@jobs.requires_auth
Scenario: Check that new job can be posted with state paused
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I post a job metadata job1.json with state paused using authorization token
Then I should get 201 status code
When I read list of jobs using authorization token
Then I should see N jobs
@jobs.requires_auth
Scenario: Check that multiple jobs can be posted with state paused
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I access jobs API /api/v1/jobs with authorization token
Then I should see N jobs
When I post a job metadata job1.json with state paused using authorization token
Then I should get 201 status code
When I read list of jobs using authorization token
Then I should see N+1 jobs
When I post a job metadata job1.json with state paused using authorization token
Then I should get 201 status code
When I read list of jobs using authorization token
Then I should see N+1 jobs
@jobs.requires_auth
Scenario: Check that job with given ID can be posted via API
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I generate unique job ID prefix
When I post a job metadata job1.json with job id TEST_1 and state paused using authorization token
Then I should get 201 status code
@jobs.requires_auth
Scenario: Check that job with given ID is really registered
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I generate unique job ID prefix
When I post a job metadata job1.json with job id TEST_2 and state paused using authorization token
Then I should get 201 status code
When I read list of jobs using authorization token
Then I should find job with id TEST_2
@jobs.requires_auth
Scenario: Check that jobs are not replaced
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I generate unique job ID prefix
When I read list of jobs using authorization token
Then I should not find job with id TEST_3
Then I should not find job with id TEST_4
Then I should not find job with id TEST_5
When I post a job metadata job1.json with job id TEST_3 and state paused using authorization token
Then I should get 201 status code
When I read list of jobs using authorization token
Then I should find job with id TEST_3
Then I should not find job with id TEST_4
Then I should not find job with id TEST_5
When I post a job metadata job1.json with job id TEST_4 and state paused using authorization token
Then I should get 201 status code
When I read list of jobs using authorization token
Then I should find job with id TEST_3
Then I should find job with id TEST_4
Then I should not find job with id TEST_5
@jobs.requires_auth
Scenario: Check that jobs can be deleted
Given System is running
When I acquire job API authorization token
When I generate unique job ID prefix
Then I should get the proper job API authorization token
When I read list of jobs using authorization token
Then I should not find job with id TEST_TO_DELETE
When I post a job metadata job1.json with job id TEST_TO_DELETE and state paused using authorization token
Then I should get 201 status code
When I read list of jobs using authorization token
Then I should find job with id TEST_TO_DELETE
When I delete job with id TEST_TO_DELETE using authorization token
Then I should get 200 status code
When I read list of jobs using authorization token
Then I should not find job with id TEST_TO_DELETE
@jobs.requires_auth
Scenario: Check that nonexistent job can't be deleted
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I read list of jobs using authorization token
Then I should not find job with id NONEXISTENT_JOB
When I delete job with id NONEXISTENT_JOB using authorization token
Then I should get 410 status code
@jobs.requires_auth
Scenario: Check that job w/o ID can't be deleted
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I delete job without ID using authorization token
Then I should get 405 status code
@jobs.requires_auth
Scenario: Check that job status can be changed
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I post a job metadata job1.json with job id PAUSED_JOB and state paused using authorization token
Then I should get 201 status code
When I read list of jobs using authorization token
Then I should find job with id PAUSED_JOB
Then I should find job with id PAUSED_JOB and state paused
When I set status for job with id PAUSED_JOB to paused using authorization token
Then I should get 200 status code
When I set status for job with id PAUSED_JOB to running using authorization token
Then I should get 200 status code
@jobs.requires_auth
Scenario: Check wrong status behaviour
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I post a job metadata job1.json with job id PAUSED_JOB_2 and state paused using authorization token
Then I should get 201 status code
When I read list of jobs using authorization token
Then I should find job with id PAUSED_JOB_2 and state paused
When I set status for job with id PAUSED_JOB_2 to unknown_state using authorization token
Then I should get 400 status code
@jobs.requires_auth
Scenario: Check setting status for wrong job behaviour
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I set status for job with id NONEXISTENT_JOB to paused using authorization token
Then I should get 404 status code
@jobs.requires_auth
Scenario: Check job service state manipulation
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I access jobs API /api/v1/service/state with authorization token
Then I should get 200 status code
Then I should receive JSON response with the state key set to running
When I set status for job service to paused using authorization token
Then I should get 200 status code
When I access jobs API /api/v1/service/state with authorization token
Then I should get 200 status code
Then I should receive JSON response with the state key set to paused
When I set status for job service to running using authorization token
Then I should get 200 status code
When I access jobs API /api/v1/service/state with authorization token
Then I should get 200 status code
Then I should receive JSON response with the state key set to running
@jobs.requires_auth
Scenario: Check job service state set to the same value
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I set status for job service to paused using authorization token
Then I should get 200 status code
When I access jobs API /api/v1/service/state with authorization token
Then I should get 200 status code
Then I should receive JSON response with the state key set to paused
When I set status for job service to paused using authorization token
Then I should get 200 status code
When I access jobs API /api/v1/service/state with authorization token
Then I should get 200 status code
Then I should receive JSON response with the state key set to paused
When I set status for job service to running using authorization token
Then I should get 200 status code
When I access jobs API /api/v1/service/state with authorization token
Then I should get 200 status code
Then I should receive JSON response with the state key set to running
When I set status for job service to running using authorization token
Then I should get 200 status code
When I access jobs API /api/v1/service/state with authorization token
Then I should get 200 status code
Then I should receive JSON response with the state key set to running
@jobs.requires_auth
Scenario: Check if improper job service state is detected properly
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I set status for job service to UNKNOWN
Then I should get 400 status code
@jobs.requires_auth
Scenario: Check if new job service state is checked
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I reset status for the job service
Then I should get 400 status code
@jobs.requires_auth
Scenario: Check the API call to clean all failed jobs
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I clean all failed jobs with authorization token
Then I should get 200 status code
Scenario: Check the logout endpoint accessed without authorization token
Given System is running
When I logout from the job service
Then I should get 401 status code
Then I should receive empty JSON response
@jobs.requires_auth
Scenario: Check the logout endpoint accessed with authorization token
Given System is running
When I acquire job API authorization token
Then I should get the proper job API authorization token
When I logout from the job service with authorization token
Then I should get 201 status code
Then I should receive empty JSON response
Scenario: Check the redirection for the generate-token endpoint
Given System is running
When I access the job service endpoint to generate token
Then I should get 200 status code
Then I should be redirected to https://github.com/login