Tommy Carpenter | 5ad8f03 | 2019-05-30 14:33:21 -0400 | [diff] [blame] | 1 | # test_a1.tavern.yaml |
| 2 | |
Tommy Carpenter | fdf0504 | 2019-07-18 20:21:21 +0000 | [diff] [blame] | 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 | |
Tommy Carpenter | 5ad8f03 | 2019-05-30 14:33:21 -0400 | [diff] [blame] | 13 | --- |
| 14 | |
| 15 | test_name: test admission control |
| 16 | |
| 17 | stages: |
Tommy Carpenter | 91ae889 | 2019-09-18 10:45:50 -0400 | [diff] [blame] | 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 | |
Tommy Carpenter | 40caa31 | 2019-09-12 16:24:10 -0400 | [diff] [blame] | 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 | |
Tommy Carpenter | 91ae889 | 2019-09-18 10:45:50 -0400 | [diff] [blame] | 85 | - name: put the admission control policy |
Tommy Carpenter | 5ad8f03 | 2019-05-30 14:33:21 -0400 | [diff] [blame] | 86 | request: |
Tommy Carpenter | 40caa31 | 2019-09-12 16:24:10 -0400 | [diff] [blame] | 87 | url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy |
Tommy Carpenter | 5ad8f03 | 2019-05-30 14:33:21 -0400 | [diff] [blame] | 88 | method: PUT |
| 89 | json: |
Tommy Carpenter | 2451446 | 2019-07-16 11:25:52 -0400 | [diff] [blame] | 90 | enforce: true |
| 91 | window_length: 10 |
| 92 | blocking_rate: 20 |
| 93 | trigger_threshold: 10 |
Tommy Carpenter | 5ad8f03 | 2019-05-30 14:33:21 -0400 | [diff] [blame] | 94 | headers: |
| 95 | content-type: application/json |
| 96 | response: |
Tommy Carpenter | 40caa31 | 2019-09-12 16:24:10 -0400 | [diff] [blame] | 97 | status_code: 201 |
Tommy Carpenter | 5ad8f03 | 2019-05-30 14:33:21 -0400 | [diff] [blame] | 98 | |
Tommy Carpenter | fdf0504 | 2019-07-18 20:21:21 +0000 | [diff] [blame] | 99 | - name: test the admission control policy get |
| 100 | request: |
Tommy Carpenter | 40caa31 | 2019-09-12 16:24:10 -0400 | [diff] [blame] | 101 | url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy |
Tommy Carpenter | fdf0504 | 2019-07-18 20:21:21 +0000 | [diff] [blame] | 102 | method: GET |
| 103 | response: |
| 104 | status_code: 200 |
| 105 | body: |
Tommy Carpenter | 40caa31 | 2019-09-12 16:24:10 -0400 | [diff] [blame] | 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: |
Tommy Carpenter | 91ae889 | 2019-09-18 10:45:50 -0400 | [diff] [blame] | 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 |
Tommy Carpenter | 40caa31 | 2019-09-12 16:24:10 -0400 | [diff] [blame] | 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 | |
Tommy Carpenter | 148e269 | 2019-09-20 10:09:01 -0400 | [diff] [blame^] | 187 | - name: create delay policy instance |
Tommy Carpenter | 40caa31 | 2019-09-12 16:24:10 -0400 | [diff] [blame] | 188 | request: |
| 189 | url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest |
| 190 | method: PUT |
Tommy Carpenter | 91ae889 | 2019-09-18 10:45:50 -0400 | [diff] [blame] | 191 | json: |
| 192 | test: foo |
Tommy Carpenter | 40caa31 | 2019-09-12 16:24:10 -0400 | [diff] [blame] | 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 |
Tommy Carpenter | 91ae889 | 2019-09-18 10:45:50 -0400 | [diff] [blame] | 204 | body: |
| 205 | test: foo |
Tommy Carpenter | 40caa31 | 2019-09-12 16:24:10 -0400 | [diff] [blame] | 206 | |
| 207 | - name: test the admission control policy status get |
Tommy Carpenter | 148e269 | 2019-09-20 10:09:01 -0400 | [diff] [blame^] | 208 | max_retries: 3 |
| 209 | delay_before: 5 # give it a few seconds for rmr ; delay reciever sleeps for 5 seconds by default |
Tommy Carpenter | 40caa31 | 2019-09-12 16:24:10 -0400 | [diff] [blame] | 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 | |
Tommy Carpenter | 148e269 | 2019-09-20 10:09:01 -0400 | [diff] [blame^] | 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 | |
Tommy Carpenter | 40caa31 | 2019-09-12 16:24:10 -0400 | [diff] [blame] | 263 | |
Tommy Carpenter | 5ad8f03 | 2019-05-30 14:33:21 -0400 | [diff] [blame] | 264 | --- |
| 265 | |
| 266 | test_name: bad_requests |
| 267 | |
| 268 | stages: |
Tommy Carpenter | 5ad8f03 | 2019-05-30 14:33:21 -0400 | [diff] [blame] | 269 | |
Tommy Carpenter | 91ae889 | 2019-09-18 10:45:50 -0400 | [diff] [blame] | 270 | - name: bad type get |
| 271 | request: |
Tommy Carpenter | 148e269 | 2019-09-20 10:09:01 -0400 | [diff] [blame^] | 272 | url: http://localhost:10000/a1-p/policytypes/20666 |
Tommy Carpenter | 91ae889 | 2019-09-18 10:45:50 -0400 | [diff] [blame] | 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 | |
Tommy Carpenter | 2451446 | 2019-07-16 11:25:52 -0400 | [diff] [blame] | 316 | - name: bad body for admission control policy |
| 317 | request: |
Tommy Carpenter | 40caa31 | 2019-09-12 16:24:10 -0400 | [diff] [blame] | 318 | url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy |
Tommy Carpenter | 2451446 | 2019-07-16 11:25:52 -0400 | [diff] [blame] | 319 | method: PUT |
| 320 | json: |
| 321 | not: "expected" |
| 322 | headers: |
| 323 | content-type: application/json |
| 324 | response: |
| 325 | status_code: 400 |
| 326 | |
Tommy Carpenter | 5ad8f03 | 2019-05-30 14:33:21 -0400 | [diff] [blame] | 327 | - name: not a json |
| 328 | request: |
Tommy Carpenter | 40caa31 | 2019-09-12 16:24:10 -0400 | [diff] [blame] | 329 | url: http://localhost:10000/a1-p/policytypes/20000/policies/admission_control_policy |
Tommy Carpenter | 5ad8f03 | 2019-05-30 14:33:21 -0400 | [diff] [blame] | 330 | method: PUT |
| 331 | data: "asdf" |
| 332 | response: |
| 333 | status_code: 415 |
| 334 | |
Tommy Carpenter | 91ae889 | 2019-09-18 10:45:50 -0400 | [diff] [blame] | 335 | - name: bad body for delaytest |
Tommy Carpenter | 5ad8f03 | 2019-05-30 14:33:21 -0400 | [diff] [blame] | 336 | request: |
Tommy Carpenter | 91ae889 | 2019-09-18 10:45:50 -0400 | [diff] [blame] | 337 | url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest |
Tommy Carpenter | 5ad8f03 | 2019-05-30 14:33:21 -0400 | [diff] [blame] | 338 | method: PUT |
| 339 | json: |
| 340 | not: "welcome" |
| 341 | response: |
| 342 | status_code: 400 |