/usr/lib/python3/dist-packages/gnocchi/tests/functional_live/gabbits/search-resource.yaml is in python3-gnocchi 4.2.0-0ubuntu5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #
# Tests to confirm resources are searchable. Run against a live setup.
# URL: http://gnocchi.xyz/rest.html#searching-for-resources
#
# Instance-ResourceID-1: a64ca14f-bc7c-45b0-aa85-42cd2179e1e2
# Instance-ResourceID-2: 7ccccfa0-92ce-4225-80ca-3ac9cb122d6a
# Instance-ResourceID-3: c442a47c-eb33-46ce-9665-f3aa0bef54e7
#
# UserID-1: 33ba83ca-2f12-4ad6-8fa2-bc8b55d36e07
# UserID-2: 81d82ef3-4deb-499d-9270-9aeb5a3ec5fe
#
# ProjectID-1: c9a5f184-c0d0-4daa-83c3-af6fdc0879e6
# ProjectID-2: 40eba01c-b348-49b8-803f-67123251a00a
#
# ImageID-1: 7ab2f7ae-7af5-4469-bdc8-3c0f6dfab75d
# ImageID-2: b01f2588-89dc-46b2-897b-fffae1e10975
#
defaults:
request_headers:
x-auth-token: $ENVIRON['GNOCCHI_SERVICE_TOKEN']
authorization: $ENVIRON['GNOCCHI_AUTHORIZATION']
tests:
#
# Setup resource types if don't exist
#
- name: create new resource type 'instance-like'
POST: /v1/resource_type
status: 201
request_headers:
content-type: application/json
data:
name: instance-like
attributes:
display_name:
type: string
required: True
flavor_id:
type: string
required: True
host:
type: string
required: True
image_ref:
type: string
required: False
server_group:
type: string
required: False
- name: create new resource type 'image-like'
POST: /v1/resource_type
status: 201
request_headers:
content-type: application/json
data:
name: image-like
attributes:
name:
type: string
required: True
disk_format:
type: string
required: True
container_format:
type: string
required: True
#
# Setup test resources
#
- name: helper. create instance-like resource-1
POST: /v1/resource/instance-like
request_headers:
content-type: application/json
data:
display_name: vm-gabbi-1
id: a64ca14f-bc7c-45b0-aa85-42cd2179e1e2
user_id: 33ba83ca-2f12-4ad6-8fa2-bc8b55d36e07
flavor_id: "1"
image_ref: 7ab2f7ae-7af5-4469-bdc8-3c0f6dfab75d
host: compute-0-gabbi.localdomain
project_id: c9a5f184-c0d0-4daa-83c3-af6fdc0879e6
status: 201
- name: helper. create instance-like resource-2
POST: /v1/resource/instance-like
request_headers:
content-type: application/json
data:
display_name: vm-gabbi-2
id: 7ccccfa0-92ce-4225-80ca-3ac9cb122d6a
user_id: 33ba83ca-2f12-4ad6-8fa2-bc8b55d36e07
flavor_id: "2"
image_ref: b01f2588-89dc-46b2-897b-fffae1e10975
host: compute-1-gabbi.localdomain
project_id: c9a5f184-c0d0-4daa-83c3-af6fdc0879e6
status: 201
- name: helper. create instance-like resource-3
POST: /v1/resource/instance-like
request_headers:
content-type: application/json
data:
display_name: vm-gabbi-3
id: c442a47c-eb33-46ce-9665-f3aa0bef54e7
user_id: 81d82ef3-4deb-499d-9270-9aeb5a3ec5fe
flavor_id: "2"
image_ref: b01f2588-89dc-46b2-897b-fffae1e10975
host: compute-1-gabbi.localdomain
project_id: 40eba01c-b348-49b8-803f-67123251a00a
status: 201
- name: helper. create image-like resource-1
POST: /v1/resource/image-like
request_headers:
content-type: application/json
data:
id: 7ab2f7ae-7af5-4469-bdc8-3c0f6dfab75d
container_format: bare
disk_format: qcow2
name: gabbi-image-1
user_id: 81d82ef3-4deb-499d-9270-9aeb5a3ec5fe
project_id: 40eba01c-b348-49b8-803f-67123251a00a
status: 201
#
# Actual tests
#
- name: search for all resources with a specific user_id
desc: search through all resource types
POST: /v1/search/resource/generic
request_headers:
content-type: application/json
data:
=:
user_id: 81d82ef3-4deb-499d-9270-9aeb5a3ec5fe
status: 200
response_json_paths:
$.`len`: 2
response_json_paths:
$.[0].type: instance-like
$.[1].type: image-like
$.[0].id: c442a47c-eb33-46ce-9665-f3aa0bef54e7
$.[1].id: 7ab2f7ae-7af5-4469-bdc8-3c0f6dfab75d
- name: search for all resources of instance-like type create by specific user_id
desc: all instances created by a specified user
POST: /v1/search/resource/generic
request_headers:
content-type: application/json
data:
and:
- =:
type: instance-like
- =:
user_id: 33ba83ca-2f12-4ad6-8fa2-bc8b55d36e07
status: 200
response_json_paths:
$.`len`: 2
response_strings:
- '"id": "a64ca14f-bc7c-45b0-aa85-42cd2179e1e2"'
- '"id": "7ccccfa0-92ce-4225-80ca-3ac9cb122d6a"'
response_json_paths:
$.[0].id: a64ca14f-bc7c-45b0-aa85-42cd2179e1e2
$.[1].id: 7ccccfa0-92ce-4225-80ca-3ac9cb122d6a
$.[0].type: instance-like
$.[1].type: instance-like
$.[0].metrics.`len`: 0
$.[1].metrics.`len`: 0
- name: search for all resources with a specific project_id
desc: search for all resources in a specific project
POST: /v1/search/resource/generic
request_headers:
content-type: application/json
data:
=:
project_id: c9a5f184-c0d0-4daa-83c3-af6fdc0879e6
status: 200
response_json_paths:
$.`len`: 2
- name: search for intances on a specific compute using "like" keyword
desc: search for vms hosted on a specific compute node
POST: /v1/search/resource/instance-like
request_headers:
content-type: application/json
data:
like:
host: 'compute-1-gabbi%'
response_json_paths:
$.`len`: 2
response_strings:
- '"project_id": "40eba01c-b348-49b8-803f-67123251a00a"'
- '"project_id": "c9a5f184-c0d0-4daa-83c3-af6fdc0879e6"'
- '"user_id": "33ba83ca-2f12-4ad6-8fa2-bc8b55d36e07"'
- '"user_id": "81d82ef3-4deb-499d-9270-9aeb5a3ec5fe"'
- '"display_name": "vm-gabbi-2"'
- '"display_name": "vm-gabbi-3"'
- name: search for instances using complex search with "like" keyword and user_id
desc: search for vms of specified user hosted on a specific compute node
POST: /v1/search/resource/instance-like
request_headers:
content-type: application/json
data:
and:
- like:
host: 'compute-%-gabbi%'
- =:
user_id: 33ba83ca-2f12-4ad6-8fa2-bc8b55d36e07
response_json_paths:
$.`len`: 2
response_strings:
- '"display_name": "vm-gabbi-1"'
- '"display_name": "vm-gabbi-2"'
- '"project_id": "c9a5f184-c0d0-4daa-83c3-af6fdc0879e6"'
- name: search for resources of instance-like or image-like type with specific user_id
desc: search for all image-like or instance-like resources created by a specific user
POST: /v1/search/resource/generic
request_headers:
content-type: application/json
data:
and:
- =:
user_id: 81d82ef3-4deb-499d-9270-9aeb5a3ec5fe
- or:
- =:
type: instance-like
- =:
type: image-like
status: 200
response_json_paths:
$.`len`: 2
response_strings:
- '"type": "image-like"'
- '"type": "instance-like"'
- '"id": "7ab2f7ae-7af5-4469-bdc8-3c0f6dfab75d"'
- '"id": "c442a47c-eb33-46ce-9665-f3aa0bef54e7"'
#
# Tear down resources
#
- name: helper. delete instance-like resource-1
DELETE: /v1/resource/instance-like/a64ca14f-bc7c-45b0-aa85-42cd2179e1e2
status: 204
- name: helper. delete instance-like resource-2
DELETE: /v1/resource/instance-like/7ccccfa0-92ce-4225-80ca-3ac9cb122d6a
status: 204
- name: helper. delete instance-like resource-3
DELETE: /v1/resource/instance-like/c442a47c-eb33-46ce-9665-f3aa0bef54e7
status: 204
- name: helper. delete image-like resource
DELETE: /v1/resource/image-like/7ab2f7ae-7af5-4469-bdc8-3c0f6dfab75d
status: 204
- name: helper. delete resource-type instance-like
DELETE: /v1/resource_type/instance-like
status: 204
- name: helper. delete resource-type image-like
DELETE: /v1/resource_type/image-like
status: 204
|