Towards a1 1.0.0; DELETE, no vector:
[ric-plt/a1.git] / integration_tests / test_a1.tavern.yaml
1 # test_a1.tavern.yaml
2
3 test_name: test healthcheck
4
5 stages:
6   - name: test the a1 healthcheck
7     request:
8       url: http://localhost:10000/a1-p/healthcheck
9       method: GET
10     response:
11       status_code: 200
12
13 ---
14
15 test_name: test admission control
16
17 stages:
18   - name: type not there yet
19     request:
20       url: http://localhost:10000/a1-p/policytypes/20000
21       method: GET
22     response:
23       status_code: 404
24
25   - name: type list empty
26     request:
27       url: http://localhost:10000/a1-p/policytypes
28       method: GET
29     response:
30       status_code: 200
31       body: []
32
33   - name: instance list 404
34     request:
35       url: http://localhost:10000/a1-p/policytypes/20000/policies
36       method: GET
37     response:
38       status_code: 404
39
40   - name: put the type
41     request:
42       url: http://localhost:10000/a1-p/policytypes/20000
43       method: PUT
44       json:
45         name: Admission Control
46         description: various parameters to control admission of dual connection
47         policy_type_id: 20000
48         create_schema:
49           "$schema": http://json-schema.org/draft-07/schema#
50           type: object
51           properties:
52             enforce:
53               type: boolean
54               default: true
55             window_length:
56               type: integer
57               default: 1
58               minimum: 1
59               maximum: 60
60               description: Sliding window length (in minutes)
61             blocking_rate:
62               type: number
63               default: 10
64               minimum: 1
65               maximum: 100
66               description: "% Connections to block"
67             trigger_threshold:
68               type: integer
69               default: 10
70               minimum: 1
71               description: Minimum number of events in window to trigger blocking
72           required:
73             - enforce
74             - blocking_rate
75             - trigger_threshold
76             - window_length
77           additionalProperties: false
78     response:
79       status_code: 201
80
81   - name: type there now
82     request:
83       url: http://localhost:10000/a1-p/policytypes/20000
84       method: GET
85     response:
86       status_code: 200
87
88   - name: now in type list
89     request:
90       url: http://localhost:10000/a1-p/policytypes
91       method: GET
92     response:
93       status_code: 200
94       body: [20000]
95
96   - name: instance list 200 but empty
97     request:
98       url: http://localhost:10000/a1-p/policytypes/20000/policies
99       method: GET
100     response:
101       status_code: 200
102       body: []
103
104   - name: test the admission control policy get not there yet
105     request:
106       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy
107       method: GET
108     response:
109       status_code: 404
110
111   - name: test the admission control policy status get not there yet
112     request:
113       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy/status
114       method: GET
115     response:
116       status_code: 404
117
118   # PUT the instance and make sure subsequent GETs return properly
119   - name: put the admission control policy instance
120     request:
121       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy
122       method: PUT
123       json:
124         enforce: true
125         window_length: 10
126         blocking_rate: 20
127         trigger_threshold: 10
128       headers:
129         content-type: application/json
130     response:
131       status_code: 202
132
133   - name: test the admission control policy get
134     request:
135       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy
136       method: GET
137     response:
138       status_code: 200
139       body:
140         enforce: true
141         window_length: 10
142         blocking_rate: 20
143         trigger_threshold: 10
144
145   - name: test the admission control policy status get
146     delay_before: 3 # give it a few seconds for rmr
147     request:
148       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy/status
149       method: GET
150     response:
151       status_code: 200
152       # tavern doesn't yet let you check string statuses!!!
153
154   - name: instance list 200 and contains the instance
155     request:
156       url: http://localhost:10000/a1-p/policytypes/20000/policies
157       method: GET
158     response:
159       status_code: 200
160       body:
161         - admission_control_policy
162
163   # DELETE the instance and make sure subsequent GETs return properly
164   - name: delete the instance
165     request:
166       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy
167       method: DELETE
168     response:
169       status_code: 202
170
171   - name: instance list 200 but no instance
172     request:
173       url: http://localhost:10000/a1-p/policytypes/20000/policies
174       method: GET
175     response:
176       status_code: 200
177       body: []
178
179   - name: cant get instance status
180     delay_before: 3 # give it a few seconds for rmr
181     request:
182       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy/status
183       method: GET
184     response:
185       status_code: 404
186
187   - name: cant get instance
188     request:
189       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy
190       method: GET
191     response:
192       status_code: 404
193
194 ---
195
196 test_name: test the delay receiver
197
198 stages:
199
200   - name: test the delay policy type not there yet
201     request:
202       url: http://localhost:10000/a1-p/policytypes/20001
203       method: GET
204     response:
205       status_code: 404
206
207   - name: not yet in type list
208     request:
209       url: http://localhost:10000/a1-p/policytypes
210       method: GET
211     response:
212       status_code: 200
213       body: [20000]
214
215   - name: instance list 404
216     request:
217       url: http://localhost:10000/a1-p/policytypes/20001/policies
218       method: GET
219     response:
220       status_code: 404
221
222   - name: put the type
223     request:
224       url: http://localhost:10000/a1-p/policytypes/20001
225       method: PUT
226       json:
227         name: test policy
228         description: just for testing
229         policy_type_id: 20001
230         create_schema:
231           "$schema": http://json-schema.org/draft-07/schema#
232           type: object
233           properties:
234             test:
235               type: string
236           required:
237             - test
238           additionalProperties: false
239     response:
240       status_code: 201
241
242   - name: type there now
243     request:
244       url: http://localhost:10000/a1-p/policytypes/20001
245       method: GET
246     response:
247       status_code: 200
248       body:
249         name: test policy
250         description: just for testing
251         policy_type_id: 20001
252         create_schema:
253           "$schema": http://json-schema.org/draft-07/schema#
254           type: object
255           properties:
256             test:
257               type: string
258           required:
259             - test
260           additionalProperties: false
261
262   - name: now in type list
263     request:
264       url: http://localhost:10000/a1-p/policytypes
265       method: GET
266     response:
267       status_code: 200
268       body:
269        - 20000
270        - 20001
271
272   - name: instance list 200 but empty
273     request:
274       url: http://localhost:10000/a1-p/policytypes/20001/policies
275       method: GET
276     response:
277       status_code: 200
278       body: []
279
280   - name: test the delay policy instance get not there yet
281     request:
282       url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest
283       method: GET
284     response:
285       status_code: 404
286
287   - name: test the delay policy status get not there yet
288     request:
289       url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest/status
290       method: GET
291     response:
292       status_code: 404
293
294   - name: create delay policy instance
295     request:
296       url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest
297       method: PUT
298       json:
299         test: foo
300       headers:
301         content-type: application/json
302     response:
303       status_code: 202
304
305   - name: test the delay policy get
306     request:
307       url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest
308       method: GET
309     response:
310       status_code: 200
311       body:
312         test: foo
313
314   - name: test the admission control policy status get
315     max_retries: 3
316     delay_before: 5  # give it a few seconds for rmr ; delay reciever sleeps for 5 seconds by default
317     request:
318       url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest/status
319       method: GET
320     response:
321       status_code: 200
322       # tavern doesn't let you check non json yet!
323
324   - name: instance list 200 and there
325     request:
326       url: http://localhost:10000/a1-p/policytypes/20001/policies
327       method: GET
328     response:
329       status_code: 200
330       body:
331        - delaytest
332
333 ---
334
335 test_name: test bad routing file endpoint
336
337 stages:
338
339   - name: put the type
340     request:
341       url: http://localhost:10000/a1-p/policytypes/20002
342       method: PUT
343       json:
344         name: test policy
345         description: just for testing
346         policy_type_id: 20002
347         create_schema:
348           "$schema": http://json-schema.org/draft-07/schema#
349           type: object
350           properties:
351             test:
352               type: string
353           required:
354             - test
355           additionalProperties: false
356
357   - name: create policy instance that will go to a broken routing endpoint
358     request:
359       url: http://localhost:10000/a1-p/policytypes/20002/policies/brokentest
360       method: PUT
361       json:
362         test: foo
363       headers:
364         content-type: application/json
365     response:
366       status_code: 202
367
368   - name: should be no status
369     delay_before: 5  # give it a few seconds for rmr ; delay reciever sleeps for 5 seconds by default
370     request:
371       url: http://localhost:10000/a1-p/policytypes/20002/policies/brokentest/status
372       method: GET
373     response:
374       status_code: 200
375       body: []
376
377
378 ---
379
380 test_name: bad_requests
381
382 stages:
383
384   - name: bad type get
385     request:
386       url: http://localhost:10000/a1-p/policytypes/20666
387       method: GET
388     response:
389       status_code: 404
390
391
392   - name: bad instance get
393     request:
394       url: http://localhost:10000/a1-p/policytypes/20000/policies/darkness
395       method: GET
396     response:
397       status_code: 404
398
399   - name: bad int range 1
400     request:
401       url: http://localhost:10000/a1-p/policytypes/19999
402       method: PUT
403       json:
404         name: test policy
405         description: just for testing
406         policy_type_id: 19999
407         create_schema:
408           "$schema": http://json-schema.org/draft-07/schema#
409           type: object
410     response:
411       status_code: 400
412
413   - name: bad int range 2
414     request:
415       url: http://localhost:10000/a1-p/policytypes/21024
416       method: PUT
417       json:
418         name: test policy
419         description: just for testing
420         policy_type_id: 21024
421         create_schema:
422           "$schema": http://json-schema.org/draft-07/schema#
423           type: object
424     response:
425       status_code: 400
426
427
428
429
430   - name: bad body for admission control policy
431     request:
432       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy
433       method: PUT
434       json:
435         not: "expected"
436       headers:
437         content-type: application/json
438     response:
439       status_code: 400
440
441   - name: not a json
442     request:
443       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy
444       method: PUT
445       data: "asdf"
446     response:
447       status_code: 415
448
449   - name: bad body for delaytest
450     request:
451       url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest
452       method: PUT
453       json:
454         not: "welcome"
455     response:
456       status_code: 400