Upgrade to rmr which required two changes
[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: put the type
26     request:
27       url: http://localhost:10000/a1-p/policytypes/20000
28       method: PUT
29       json:
30         name: Admission Control
31         description: various parameters to control admission of dual connection
32         policy_type_id: 20000
33         create_schema:
34           "$schema": http://json-schema.org/draft-07/schema#
35           type: object
36           properties:
37             enforce:
38               type: boolean
39               default: true
40             window_length:
41               type: integer
42               default: 1
43               minimum: 1
44               maximum: 60
45               description: Sliding window length (in minutes)
46             blocking_rate:
47               type: number
48               default: 10
49               minimum: 1
50               maximum: 100
51               description: "% Connections to block"
52             trigger_threshold:
53               type: integer
54               default: 10
55               minimum: 1
56               description: Minimum number of events in window to trigger blocking
57           required:
58             - enforce
59             - blocking_rate
60             - trigger_threshold
61             - window_length
62           additionalProperties: false
63
64   - name: type there now
65     request:
66       url: http://localhost:10000/a1-p/policytypes/20000
67       method: GET
68     response:
69       status_code: 200
70
71   - name: test the admission control policy get not there yet
72     request:
73       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy
74       method: GET
75     response:
76       status_code: 404
77
78   - name: test the admission control policy status get not there yet
79     request:
80       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy/status
81       method: GET
82     response:
83       status_code: 404
84
85   - name: put the admission control policy
86     request:
87       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy
88       method: PUT
89       json:
90         enforce: true
91         window_length: 10
92         blocking_rate: 20
93         trigger_threshold: 10
94       headers:
95         content-type: application/json
96     response:
97       status_code: 201
98
99   - name: test the admission control policy get
100     request:
101       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy
102       method: GET
103     response:
104       status_code: 200
105       body:
106         enforce: true
107         window_length: 10
108         blocking_rate: 20
109         trigger_threshold: 10
110
111   - name: test the admission control policy status get
112     delay_before: 3 # give it a few seconds for rmr
113     request:
114       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy/status
115       method: GET
116     response:
117       status_code: 200
118       body:
119         - handler_id: test_receiver
120           status: OK
121
122 ---
123
124 test_name: test the delay receiver
125
126 stages:
127
128   - name: test the delay policy type not there yet
129     request:
130       url: http://localhost:10000/a1-p/policytypes/20001
131       method: GET
132     response:
133       status_code: 404
134
135   - name: put the type
136     request:
137       url: http://localhost:10000/a1-p/policytypes/20001
138       method: PUT
139       json:
140         name: test policy
141         description: just for testing
142         policy_type_id: 20001
143         create_schema:
144           "$schema": http://json-schema.org/draft-07/schema#
145           type: object
146           properties:
147             test:
148               type: string
149           required:
150             - test
151           additionalProperties: false
152
153   - name: type there now
154     request:
155       url: http://localhost:10000/a1-p/policytypes/20001
156       method: GET
157     response:
158       status_code: 200
159       body:
160         name: test policy
161         description: just for testing
162         policy_type_id: 20001
163         create_schema:
164           "$schema": http://json-schema.org/draft-07/schema#
165           type: object
166           properties:
167             test:
168               type: string
169           required:
170             - test
171           additionalProperties: false
172
173   - name: test the delay policy instance get not there yet
174     request:
175       url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest
176       method: GET
177     response:
178       status_code: 404
179
180   - name: test the delay policy status get not there yet
181     request:
182       url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest/status
183       method: GET
184     response:
185       status_code: 404
186
187   - name: create delay policy instance
188     request:
189       url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest
190       method: PUT
191       json:
192         test: foo
193       headers:
194         content-type: application/json
195     response:
196       status_code: 201
197
198   - name: test the delay policy get
199     request:
200       url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest
201       method: GET
202     response:
203       status_code: 200
204       body:
205         test: foo
206
207   - name: test the admission control policy status get
208     max_retries: 3
209     delay_before: 5  # give it a few seconds for rmr ; delay reciever sleeps for 5 seconds by default
210     request:
211       url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest/status
212       method: GET
213     response:
214       status_code: 200
215       body:
216         - handler_id: delay_receiver
217           status: OK
218
219 ---
220
221 test_name: test bad routing file endpoint
222
223 stages:
224
225   - name: put the type
226     request:
227       url: http://localhost:10000/a1-p/policytypes/20002
228       method: PUT
229       json:
230         name: test policy
231         description: just for testing
232         policy_type_id: 20002
233         create_schema:
234           "$schema": http://json-schema.org/draft-07/schema#
235           type: object
236           properties:
237             test:
238               type: string
239           required:
240             - test
241           additionalProperties: false
242
243   - name: create policy instance that will go to a broken routing endpoint
244     request:
245       url: http://localhost:10000/a1-p/policytypes/20002/policies/brokentest
246       method: PUT
247       json:
248         test: foo
249       headers:
250         content-type: application/json
251     response:
252       status_code: 201
253
254   - name: should be no status
255     delay_before: 5  # give it a few seconds for rmr ; delay reciever sleeps for 5 seconds by default
256     request:
257       url: http://localhost:10000/a1-p/policytypes/20002/policies/brokentest/status
258       method: GET
259     response:
260       status_code: 200
261       body: []
262
263
264 ---
265
266 test_name: bad_requests
267
268 stages:
269
270   - name: bad type get
271     request:
272       url: http://localhost:10000/a1-p/policytypes/20666
273       method: GET
274     response:
275       status_code: 404
276
277
278   - name: bad instance get
279     request:
280       url: http://localhost:10000/a1-p/policytypes/20000/policies/darkness
281       method: GET
282     response:
283       status_code: 404
284
285   - name: bad int range 1
286     request:
287       url: http://localhost:10000/a1-p/policytypes/19999
288       method: PUT
289       json:
290         name: test policy
291         description: just for testing
292         policy_type_id: 19999
293         create_schema:
294           "$schema": http://json-schema.org/draft-07/schema#
295           type: object
296     response:
297       status_code: 400
298
299   - name: bad int range 2
300     request:
301       url: http://localhost:10000/a1-p/policytypes/21024
302       method: PUT
303       json:
304         name: test policy
305         description: just for testing
306         policy_type_id: 21024
307         create_schema:
308           "$schema": http://json-schema.org/draft-07/schema#
309           type: object
310     response:
311       status_code: 400
312
313
314
315
316   - name: bad body for admission control policy
317     request:
318       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy
319       method: PUT
320       json:
321         not: "expected"
322       headers:
323         content-type: application/json
324     response:
325       status_code: 400
326
327   - name: not a json
328     request:
329       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy
330       method: PUT
331       data: "asdf"
332     response:
333       status_code: 415
334
335   - name: bad body for delaytest
336     request:
337       url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest
338       method: PUT
339       json:
340         not: "welcome"
341     response:
342       status_code: 400