Towards A1 v1.0.0
[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: test the delay policy
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     delay_before: 8  # give it a few seconds for rmr ; delay reciever sleeps for 5 seconds by default
209     request:
210       url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest/status
211       method: GET
212     response:
213       status_code: 200
214       body:
215         - handler_id: delay_receiver
216           status: OK
217
218
219 ---
220
221 test_name: bad_requests
222
223 stages:
224
225   - name: bad type get
226     request:
227       url: http://localhost:10000/a1-p/policytypes/20002
228       method: GET
229     response:
230       status_code: 404
231
232
233   - name: bad instance get
234     request:
235       url: http://localhost:10000/a1-p/policytypes/20000/policies/darkness
236       method: GET
237     response:
238       status_code: 404
239
240   - name: bad int range 1
241     request:
242       url: http://localhost:10000/a1-p/policytypes/19999
243       method: PUT
244       json:
245         name: test policy
246         description: just for testing
247         policy_type_id: 19999
248         create_schema:
249           "$schema": http://json-schema.org/draft-07/schema#
250           type: object
251     response:
252       status_code: 400
253
254   - name: bad int range 2
255     request:
256       url: http://localhost:10000/a1-p/policytypes/21024
257       method: PUT
258       json:
259         name: test policy
260         description: just for testing
261         policy_type_id: 21024
262         create_schema:
263           "$schema": http://json-schema.org/draft-07/schema#
264           type: object
265     response:
266       status_code: 400
267
268
269
270
271   - name: bad body for admission control policy
272     request:
273       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy
274       method: PUT
275       json:
276         not: "expected"
277       headers:
278         content-type: application/json
279     response:
280       status_code: 400
281
282   - name: not a json
283     request:
284       url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy
285       method: PUT
286       data: "asdf"
287     response:
288       status_code: 415
289
290   - name: bad body for delaytest
291     request:
292       url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest
293       method: PUT
294       json:
295         not: "welcome"
296     response:
297       status_code: 400