summaryrefslogtreecommitdiff
path: root/nova/tests/functional/api/openstack/placement/gabbits/usage.yaml
blob: 8fa8995652d9b3becee8cbfd3f3301c6101da186 (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
# More interesting tests for usages are in with_allocations

fixtures:
    - APIFixture

defaults:
    request_headers:
        accept: application/json
        x-auth-token: admin

tests:

- name: fail to get usages for missing provider
  GET: /resource_providers/fae14fa3-4b43-498c-a33c-4a1d00edb577/usages
  status: 404
  response_strings:
      - No resource provider with uuid fae14fa3-4b43-498c-a33c-4a1d00edb577 found
  response_json_paths:
      $.errors[0].title: Not Found

- name: create provider
  POST: /resource_providers
  request_headers:
      content-type: application/json
  data:
      name: a name
  status: 201

- name: check provider exists
  GET: $LOCATION
  response_json_paths:
      name: a name

- name: get empty usages
  GET: $LAST_URL/usages
  request_headers:
      content-type: application/json
  response_json_paths:
      usages: {}

- name: get usages no cache headers base microversion
  GET: $LAST_URL
  response_forbidden_headers:
      - last-modified
      - cache-control

- name: get usages cache headers 1.15
  GET: $LAST_URL
  request_headers:
      openstack-api-version: placement 1.15
  response_headers:
      cache-control: no-cache
      # Does last-modified look like a legit timestamp?
      last-modified:  /^\w+, \d+ \w+ \d{4} [\d:]+ GMT$/

- name: get total usages earlier version
  GET: /usages?project_id=$ENVIRON['PROJECT_ID']
  request_headers:
      openstack-api-version: placement 1.8
  status: 404

- name: get total usages no project or user
  GET: /usages
  request_headers:
      openstack-api-version: placement 1.9
  status: 400

- name: get total usages project_id less than min length
  GET: /usages?project_id=
  request_headers:
      openstack-api-version: placement 1.9
  status: 400
  response_strings:
      - "Failed validating 'minLength'"

- name: get total usages user_id less than min length
  GET: /usages?project_id=$ENVIRON['PROJECT_ID']&user_id=
  request_headers:
      openstack-api-version: placement 1.9
  status: 400
  response_strings:
      - "Failed validating 'minLength'"

- name: get total usages project_id exceeds max length
  GET: /usages?project_id=78725f09-5c01-4c9e-97a5-98d75e1e32b178725f09-5c01-4c9e-97a5-98d75e1e32b178725f09-5c01-4c9e-97a5-98d75e1e32b178725f09-5c01-4c9e-97a5-98d75e1e32b178725f09-5c01-4c9e-97a5-98d75e1e32b178725f09-5c01-4c9e-97a5-98d75e1e32b178725f09-5c01-4c9e-97a5-98d75e1e32b178725f09-5c01-4c9e-97a5-98d75e1e32b1
  request_headers:
      openstack-api-version: placement 1.9
  status: 400
  response_strings:
      - "Failed validating 'maxLength'"

- name: get total usages user_id exceeds max length
  GET: /usages?project_id=$ENVIRON['PROJECT_ID']&user_id=78725f09-5c01-4c9e-97a5-98d75e1e32b178725f09-5c01-4c9e-97a5-98d75e1e32b178725f09-5c01-4c9e-97a5-98d75e1e32b178725f09-5c01-4c9e-97a5-98d75e1e32b178725f09-5c01-4c9e-97a5-98d75e1e32b178725f09-5c01-4c9e-97a5-98d75e1e32b178725f09-5c01-4c9e-97a5-98d75e1e32b178725f09-5c01-4c9e-97a5-98d75e1e32b1
  request_headers:
      openstack-api-version: placement 1.9
  status: 400
  response_strings:
      - "Failed validating 'maxLength'"