summaryrefslogtreecommitdiff
path: root/nova/tests/functional/api/openstack/placement/gabbits/resource-classes.yaml
blob: 638b03a33c7c7c12654a702056882df7333cb483 (plain)
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
fixtures:
    - APIFixture

defaults:
    request_headers:
        x-auth-token: admin
        accept: application/json
        openstack-api-version: placement latest

tests:

- name: test microversion masks resource-classes endpoint for list with 404
  GET: /resource_classes
  request_headers:
    openstack-api-version: placement 1.1
  status: 404
  response_json_paths:
      $.errors[0].title: Not Found

- name: test microversion masks resource-classes endpoint for create with 404
  desc: we want to get a 404 even if content-type is correct
  POST: /resource_classes
  request_headers:
    openstack-api-version: placement 1.1
    content-type: application/json
  data:
      name: CUSTOM_NFV_BAR
  status: 404
  response_json_paths:
      $.errors[0].title: Not Found

- name: test microversion mask when wrong content type
  desc: we want to get a 404 before a 415
  POST: /resource_classes
  request_headers:
    openstack-api-version: placement 1.1
    content-type: text/plain
  data: data
  status: 404

- name: test wrong content type
  desc: we want to get a 415 when bad content type
  POST: /resource_classes
  request_headers:
    openstack-api-version: placement 1.2
    content-type: text/plain
  data: data
  status: 415

- name: what is at resource classes
  GET: /resource_classes
  response_json_paths:
  response_json_paths:
      $.resource_classes.`len`: 14  #  Number of standard resource classes
      $.resource_classes[0].name: VCPU

- name: non admin forbidden
  GET: /resource_classes
  request_headers:
      x-auth-token: user
      accept: application/json
  status: 403
  response_json_paths:
      $.errors[0].title: Forbidden

- name: post invalid non json
  POST: /resource_classes
  request_headers:
    accept: text/plain
    content-type: application/json
  data:
      name: FOO
  status: 400
  response_strings:
      - JSON does not validate

- name: post illegal characters in name
  POST: /resource_classes
  request_headers:
    content-type: application/json
  data:
      name: CUSTOM_Illegal&@!Name?
  status: 400
  response_strings:
      - JSON does not validate
  response_json_paths:
      $.errors[0].title: Bad Request

- name: post new resource class
  POST: /resource_classes
  request_headers:
    content-type: application/json
  data:
      name: $ENVIRON['CUSTOM_RES_CLASS']
  status: 201
  response_headers:
      location: //resource_classes/$ENVIRON['CUSTOM_RES_CLASS']/
  response_forbidden_headers:
      - content-type

- name: try to create same again
  POST: /resource_classes
  request_headers:
    content-type: application/json
  data:
      name: $ENVIRON['CUSTOM_RES_CLASS']
  status: 409
  response_strings:
      - Conflicting resource class already exists
  response_json_paths:
      $.errors[0].title: Conflict

- name: confirm the correct post
  GET: /resource_classes/$ENVIRON['CUSTOM_RES_CLASS']
  request_headers:
      content-type: application/json
  response_json_paths:
      $.name: $ENVIRON['CUSTOM_RES_CLASS']
      $.links[?rel = "self"].href: /resource_classes/$ENVIRON['CUSTOM_RES_CLASS']

- name: test microversion masks resource-classes endpoint for show with 404
  GET: /resource_classes/$ENVIRON['CUSTOM_RES_CLASS']
  request_headers:
    openstack-api-version: placement 1.1
  status: 404
  response_json_paths:
      $.errors[0].title: Not Found

- name: get resource class works with no accept
  GET: /resource_classes/$ENVIRON['CUSTOM_RES_CLASS']
  request_headers:
    content-type: application/json
  response_headers:
      content-type: /application/json/
  response_json_paths:
      $.name: $ENVIRON['CUSTOM_RES_CLASS']

- name: list resource classes after addition of custom res class
  GET: /resource_classes
  response_json_paths:
      $.resource_classes.`len`: 15  # 14 standard plus 1 custom
      $.resource_classes[14].name: $ENVIRON['CUSTOM_RES_CLASS']
      $.resource_classes[14].links[?rel = "self"].href: /resource_classes/$ENVIRON['CUSTOM_RES_CLASS']

- name: update standard resource class bad json
  PUT: /resource_classes/VCPU
  request_headers:
    content-type: application/json
    openstack-api-version: placement 1.6
  data:
      name: VCPU_ALTERNATE
  status: 400
  response_strings:
      - JSON does not validate
  response_json_paths:
      $.errors[0].title: Bad Request

- name: update standard resource class to custom
  desc: standard classes cannot be updated
  PUT: /resource_classes/VCPU
  request_headers:
    content-type: application/json
    openstack-api-version: placement 1.6
  data:
      name: $ENVIRON['CUSTOM_RES_CLASS']
  status: 400
  response_strings:
      - Cannot update standard resource class VCPU
  response_json_paths:
      $.errors[0].title: Bad Request

- name: update custom resource class to standard resource class name
  PUT: /resource_classes/$ENVIRON['CUSTOM_RES_CLASS']
  request_headers:
    content-type: application/json
    openstack-api-version: placement 1.6
  data:
      name: VCPU
  status: 400
  response_strings:
      - JSON does not validate
  response_json_paths:
      $.errors[0].title: Bad Request

- name: post another custom resource class
  POST: /resource_classes
  request_headers:
    content-type: application/json
  data:
      name: CUSTOM_NFV_FOO
  status: 201

- name: update custom resource class to already existing custom resource class name
  PUT: /resource_classes/CUSTOM_NFV_FOO
  request_headers:
    content-type: application/json
    openstack-api-version: placement 1.6
  data:
      name: $ENVIRON['CUSTOM_RES_CLASS']
  status: 409
  response_strings:
      - Resource class already exists
      - $ENVIRON['CUSTOM_RES_CLASS']
  response_json_paths:
      $.errors[0].title: Conflict

- name: test microversion masks resource-classes endpoint for update with 404
  PUT: /resource_classes/$ENVIRON['CUSTOM_RES_CLASS']
  request_headers:
    openstack-api-version: placement 1.1
    content-type: application/json
  data:
      name: CUSTOM_NFV_BAR
  status: 404
  response_json_paths:
      $.errors[0].title: Not Found

- name: update custom resource class with additional properties
  PUT: /resource_classes/$ENVIRON['CUSTOM_RES_CLASS']
  request_headers:
    content-type: application/json
    openstack-api-version: placement 1.6
  data:
      name: CUSTOM_NFV_BAR
      additional: additional
  status: 400
  response_strings:
      - Additional properties are not allowed

- name: update custom resource class
  PUT: /resource_classes/$ENVIRON['CUSTOM_RES_CLASS']
  request_headers:
    content-type: application/json
    openstack-api-version: placement 1.6
  data:
      name: CUSTOM_NFV_BAR
  status: 200
  response_json_paths:
      $.name: CUSTOM_NFV_BAR
      $.links[?rel = "self"].href: /resource_classes/CUSTOM_NFV_BAR

- name: delete standard resource class
  DELETE: /resource_classes/VCPU
  status: 400
  response_strings:
      - Cannot delete standard resource class
  response_json_paths:
      $.errors[0].title: Bad Request

- name: test microversion masks resource-classes endpoint for delete with 404
  DELETE: /resource_classes/CUSTOM_NFV_BAR
  request_headers:
    openstack-api-version: placement 1.1
  status: 404
  response_json_paths:
      $.errors[0].title: Not Found

- name: delete custom resource class
  DELETE: /resource_classes/CUSTOM_NFV_BAR
  status: 204

- name: 404 on deleted resource class
  DELETE: $LAST_URL
  status: 404
  response_json_paths:
      $.errors[0].title: Not Found

- name: post malformed json as json
  POST: /resource_classes
  request_headers:
      content-type: application/json
  data: '{"foo": }'
  status: 400
  response_strings:
      - 'Malformed JSON:'
  response_json_paths:
      $.errors[0].title: Bad Request

- name: post bad resource class name IRON_NFV
  POST: /resource_classes
  request_headers:
      content-type: application/json
  data:
      name: IRON_NFV  # Doesn't start with CUSTOM_
  status: 400
  response_strings:
      - JSON does not validate
  response_json_paths:
      $.errors[0].title: Bad Request

- name: try to create resource class with name exceed max characters
  POST: /resource_classes
  request_headers:
      content-type: application/json
  data:
      name: &name_exceeds_max_length_check CUSTOM_THIS_IS_A_LONG_TEXT_OF_LENGTH_256_CHARACTERSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
  status: 400
  response_strings:
      - "Failed validating 'maxLength'"
  response_json_paths:
      $.errors[0].title: Bad Request

- name: try to update resource class with name exceed max characters
  PUT: /resource_classes/$ENVIRON['CUSTOM_RES_CLASS']
  request_headers:
      content-type: application/json
      openstack-api-version: placement 1.6
  data:
      name: *name_exceeds_max_length_check
  status: 400
  response_strings:
      - "Failed validating 'maxLength'"
  response_json_paths:
      $.errors[0].title: Bad Request

- name: try to create resource class with additional properties
  POST: /resource_classes
  request_headers:
      content-type: application/json
  data:
      name: CUSTOM_NFV_BAR
      additional: additional
  status: 400
  response_strings:
      - Additional properties are not allowed