685 lines
19 KiB
YAML
685 lines
19 KiB
YAML
#
|
||
# Confirmation tests to run against a live web server.
|
||
#
|
||
# These act as a very basic sanity check.
|
||
|
||
defaults:
|
||
request_headers:
|
||
x-auth-token: $ENVIRON['GNOCCHI_SERVICE_TOKEN']
|
||
authorization: $ENVIRON['GNOCCHI_AUTHORIZATION']
|
||
|
||
tests:
|
||
- name: check /
|
||
GET: /
|
||
|
||
# Fail to create archive policy
|
||
- name: wrong archive policy content type
|
||
desc: attempt to create archive policy with invalid content-type
|
||
POST: /v1/archive_policy
|
||
request_headers:
|
||
content-type: text/plain
|
||
status: 415
|
||
response_strings:
|
||
- Unsupported Media Type
|
||
|
||
- name: wrong method
|
||
desc: attempt to create archive policy with 'PUT' method
|
||
PUT: /v1/archive_policy
|
||
request_headers:
|
||
content-type: application/json
|
||
status: 405
|
||
|
||
- name: invalid authZ
|
||
desc: x-auth-token is invalid
|
||
POST: /v1/archive_policy
|
||
request_headers:
|
||
content-type: application/json
|
||
x-auth-token: 'hello'
|
||
authorization: 'basic hello:'
|
||
data:
|
||
name: medium
|
||
definition:
|
||
- granularity: 1 second
|
||
status: 401
|
||
|
||
- name: bad archive policy body
|
||
desc: archive policy contains invalid key 'cowsay'
|
||
POST: /v1/archive_policy
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
cowsay: moo
|
||
status: 400
|
||
response_strings:
|
||
- "Invalid input: extra keys not allowed"
|
||
|
||
- name: missing definition
|
||
desc: archive policy is missing 'definition' keyword
|
||
POST: /v1/archive_policy
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
name: medium
|
||
status: 400
|
||
response_strings:
|
||
- "Invalid input: required key not provided"
|
||
|
||
- name: empty definition
|
||
desc: empty definition for archive policy
|
||
POST: /v1/archive_policy
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
name: medium
|
||
definition: []
|
||
status: 400
|
||
response_strings:
|
||
- "Invalid input: length of value must be at least 1"
|
||
|
||
- name: wrong value definition
|
||
desc: invalid type of 'definition' key
|
||
POST: /v1/archive_policy
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
name: somename
|
||
definition: foobar
|
||
status: 400
|
||
response_strings:
|
||
- "Invalid input: expected a list"
|
||
|
||
- name: useless definition
|
||
desc: invalid archive policy definition
|
||
POST: /v1/archive_policy
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
name: medium
|
||
definition:
|
||
- cowsay: moo
|
||
status: 400
|
||
response_strings:
|
||
- "Invalid input: extra keys not allowed"
|
||
|
||
#
|
||
# Create archive policy
|
||
#
|
||
|
||
- name: create archive policy
|
||
desc: create archve policy 'gabbilive' for live tests
|
||
POST: /v1/archive_policy
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
name: gabbilive
|
||
back_window: 0
|
||
definition:
|
||
- granularity: 1 second
|
||
points: 60
|
||
- granularity: 2 second
|
||
timespan: 1 minute
|
||
- points: 5
|
||
timespan: 5 minute
|
||
aggregation_methods:
|
||
- mean
|
||
- min
|
||
- max
|
||
response_headers:
|
||
location: $SCHEME://$NETLOC/v1/archive_policy/gabbilive
|
||
status: 201
|
||
|
||
# Retrieve it correctly and then poorly
|
||
|
||
- name: get archive policy
|
||
desc: retrieve archive policy 'gabbilive' and asster its values
|
||
GET: $LOCATION
|
||
response_headers:
|
||
content-type: /application/json/
|
||
response_json_paths:
|
||
$.name: gabbilive
|
||
$.back_window: 0
|
||
$.definition[0].granularity: "0:00:01"
|
||
$.definition[0].points: 60
|
||
$.definition[0].timespan: "0:01:00"
|
||
$.definition[1].granularity: "0:00:02"
|
||
$.definition[1].points: 30
|
||
$.definition[1].timespan: "0:01:00"
|
||
$.definition[2].granularity: "0:01:00"
|
||
$.definition[2].points: 5
|
||
$.definition[2].timespan: "0:05:00"
|
||
response_json_paths:
|
||
$.aggregation_methods.`sorted`: ["max", "mean", "min"]
|
||
|
||
- name: get wrong accept
|
||
desc: invalid 'accept' header
|
||
GET: /v1/archive_policy/medium
|
||
request_headers:
|
||
accept: text/plain
|
||
status: 406
|
||
|
||
# Unexpected methods
|
||
|
||
- name: post single archive
|
||
desc: unexpected 'POST' request to archive policy
|
||
POST: /v1/archive_policy/gabbilive
|
||
status: 405
|
||
|
||
- name: put single archive
|
||
desc: unexpected 'PUT' request to archive policy
|
||
PUT: /v1/archive_policy/gabbilive
|
||
status: 405
|
||
|
||
# Duplicated archive policy names ain't allowed
|
||
|
||
- name: create duplicate archive policy
|
||
desc: create archve policy 'gabbilive' for live tests
|
||
POST: /v1/archive_policy
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
name: gabbilive
|
||
definition:
|
||
- granularity: 30 second
|
||
points: 60
|
||
status: 409
|
||
response_strings:
|
||
- Archive policy gabbilive already exists
|
||
|
||
# Create a unicode named policy
|
||
|
||
- name: post unicode policy name
|
||
POST: /v1/archive_policy
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
name: ✔éñ☃
|
||
definition:
|
||
- granularity: 1 minute
|
||
points: 20
|
||
status: 201
|
||
response_headers:
|
||
location: $SCHEME://$NETLOC/v1/archive_policy/%E2%9C%94%C3%A9%C3%B1%E2%98%83
|
||
response_json_paths:
|
||
name: ✔éñ☃
|
||
|
||
- name: retrieve unicode policy name
|
||
GET: $LOCATION
|
||
response_json_paths:
|
||
name: ✔éñ☃
|
||
|
||
- name: delete unicode archive policy
|
||
DELETE: /v1/archive_policy/%E2%9C%94%C3%A9%C3%B1%E2%98%83
|
||
status: 204
|
||
|
||
# It really is gone
|
||
|
||
- name: confirm delete
|
||
desc: assert deleted unicode policy is not available
|
||
GET: /v1/archive_policy/%E2%9C%94%C3%A9%C3%B1%E2%98%83
|
||
status: 404
|
||
|
||
# Fail to delete one that does not exist
|
||
|
||
- name: delete missing archive
|
||
desc: delete non-existent archive policy
|
||
DELETE: /v1/archive_policy/grandiose
|
||
status: 404
|
||
response_strings:
|
||
- Archive policy grandiose does not exist
|
||
|
||
# Attempt to create illogical policies
|
||
|
||
- name: create illogical policy
|
||
POST: /v1/archive_policy
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
name: complex
|
||
definition:
|
||
- granularity: 1 second
|
||
points: 60
|
||
timespan: "0:01:01"
|
||
status: 400
|
||
response_strings:
|
||
- timespan ≠ granularity × points
|
||
|
||
- name: create identical granularities policy
|
||
POST: /v1/archive_policy
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
name: complex
|
||
definition:
|
||
- granularity: 1 second
|
||
points: 60
|
||
- granularity: 1 second
|
||
points: 120
|
||
status: 400
|
||
response_strings:
|
||
- "More than one archive policy uses granularity `1.0'"
|
||
|
||
- name: policy invalid unit
|
||
desc: invalid unit for archive policy 'timespan' key
|
||
POST: /v1/archive_policy
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
name: 227d0e1f-4295-4e4b-8515-c296c47d71d3
|
||
definition:
|
||
- granularity: 1 second
|
||
timespan: "1 shenanigan"
|
||
status: 400
|
||
|
||
#
|
||
# Archive policy rules
|
||
#
|
||
|
||
- name: create archive policy rule1
|
||
POST: /v1/archive_policy_rule
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
name: gabbilive_rule
|
||
metric_pattern: "live.*"
|
||
archive_policy_name: gabbilive
|
||
status: 201
|
||
response_json_paths:
|
||
$.metric_pattern: "live.*"
|
||
$.archive_policy_name: gabbilive
|
||
$.name: gabbilive_rule
|
||
|
||
- name: create invalid archive policy rule
|
||
POST: /v1/archive_policy_rule
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
name: test_rule
|
||
metric_pattern: "disk.foo.*"
|
||
status: 400
|
||
|
||
- name: missing auth archive policy rule
|
||
POST: /v1/archive_policy_rule
|
||
request_headers:
|
||
content-type: application/json
|
||
x-auth-token: 'hello'
|
||
authorization: 'basic hello:'
|
||
data:
|
||
name: test_rule
|
||
metric_pattern: "disk.foo.*"
|
||
archive_policy_name: low
|
||
status: 401
|
||
|
||
- name: wrong archive policy rule content type
|
||
POST: /v1/archive_policy_rule
|
||
request_headers:
|
||
content-type: text/plain
|
||
status: 415
|
||
response_strings:
|
||
- Unsupported Media Type
|
||
|
||
- name: bad archive policy rule body
|
||
POST: /v1/archive_policy_rule
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
whaa: foobar
|
||
status: 400
|
||
response_strings:
|
||
- "Invalid input: extra keys not allowed"
|
||
|
||
# get an archive policy rules
|
||
|
||
- name: get all archive policy rules
|
||
GET: /v1/archive_policy_rule
|
||
status: 200
|
||
response_json_paths:
|
||
$[\name][0].name: "gabbilive_rule"
|
||
$[\name][0].metric_pattern: "live.*"
|
||
$[\name][0].archive_policy_name: "gabbilive"
|
||
|
||
- name: get unknown archive policy rule
|
||
GET: /v1/archive_policy_rule/foo
|
||
status: 404
|
||
|
||
|
||
- name: get archive policy rule
|
||
GET: /v1/archive_policy_rule/gabbilive_rule
|
||
status: 200
|
||
response_json_paths:
|
||
$.metric_pattern: "live.*"
|
||
$.archive_policy_name: "gabbilive"
|
||
$.name: "gabbilive_rule"
|
||
|
||
- name: delete archive policy in use
|
||
desc: fails due to https://bugs.launchpad.net/gnocchi/+bug/1569781
|
||
DELETE: /v1/archive_policy/gabbilive
|
||
status: 400
|
||
|
||
#
|
||
# Metrics
|
||
#
|
||
|
||
|
||
- name: get all metrics
|
||
GET: /v1/metric
|
||
status: 200
|
||
|
||
- name: create metric with name and rule
|
||
POST: /v1/metric
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
name: "live.io.rate"
|
||
status: 201
|
||
response_json_paths:
|
||
$.archive_policy_name: gabbilive
|
||
$.name: live.io.rate
|
||
|
||
- name: delete metric
|
||
DELETE: $LOCATION
|
||
status: 204
|
||
|
||
- name: create metric with name and policy
|
||
POST: /v1/metric
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
name: "aagabbi.live.metric"
|
||
archive_policy_name: "gabbilive"
|
||
status: 201
|
||
response_json_paths:
|
||
$.archive_policy_name: gabbilive
|
||
$.name: "aagabbi.live.metric"
|
||
|
||
- name: get valid metric id
|
||
GET: $LOCATION
|
||
status: 200
|
||
response_json_paths:
|
||
$.archive_policy.name: gabbilive
|
||
|
||
- name: delete the metric
|
||
DELETE: /v1/metric/$RESPONSE['$.id']
|
||
status: 204
|
||
|
||
- name: create metric bad archive policy
|
||
POST: /v1/metric
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
archive_policy_name: 2e2675aa-105e-4664-a30d-c407e6a0ea7f
|
||
status: 400
|
||
response_strings:
|
||
- Archive policy 2e2675aa-105e-4664-a30d-c407e6a0ea7f does not exist
|
||
|
||
- name: create metric bad content-type
|
||
POST: /v1/metric
|
||
request_headers:
|
||
content-type: plain/text
|
||
data: '{"archive_policy_name": "cookies"}'
|
||
status: 415
|
||
|
||
|
||
#
|
||
# Cleanup
|
||
#
|
||
|
||
- name: delete archive policy rule
|
||
DELETE: /v1/archive_policy_rule/gabbilive_rule
|
||
status: 204
|
||
|
||
- name: confirm delete archive policy rule
|
||
DELETE: /v1/archive_policy_rule/gabbilive_rule
|
||
status: 404
|
||
|
||
|
||
#
|
||
# Resources section
|
||
#
|
||
|
||
- name: root of resource
|
||
GET: /v1/resource
|
||
response_json_paths:
|
||
$.generic: $SCHEME://$NETLOC/v1/resource/generic
|
||
|
||
- name: typo of resource
|
||
GET: /v1/resoue
|
||
status: 404
|
||
|
||
- name: typo of resource extra
|
||
GET: /v1/resource/foobar
|
||
status: 404
|
||
|
||
- name: generic resource
|
||
GET: /v1/resource/generic
|
||
status: 200
|
||
|
||
- name: post resource type
|
||
POST: /v1/resource_type
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
name: myresource
|
||
attributes:
|
||
display_name:
|
||
type: string
|
||
required: true
|
||
max_length: 5
|
||
min_length: 2
|
||
status: 201
|
||
response_headers:
|
||
location: $SCHEME://$NETLOC/v1/resource_type/myresource
|
||
|
||
- name: add an attribute
|
||
PATCH: /v1/resource_type/myresource
|
||
request_headers:
|
||
content-type: application/json-patch+json
|
||
data:
|
||
- op: "add"
|
||
path: "/attributes/awesome-stuff"
|
||
value: {"type": "bool", "required": false}
|
||
status: 200
|
||
response_json_paths:
|
||
$.name: myresource
|
||
$.attributes."awesome-stuff".type: bool
|
||
$.attributes.[*].`len`: 2
|
||
|
||
- name: remove an attribute
|
||
PATCH: /v1/resource_type/myresource
|
||
request_headers:
|
||
content-type: application/json-patch+json
|
||
data:
|
||
- op: "remove"
|
||
path: "/attributes/awesome-stuff"
|
||
status: 200
|
||
response_json_paths:
|
||
$.name: myresource
|
||
$.attributes.display_name.type: string
|
||
$.attributes.[*].`len`: 1
|
||
|
||
- name: myresource resource bad accept
|
||
desc: Expect 406 on bad accept type
|
||
request_headers:
|
||
accept: text/plain
|
||
GET: /v1/resource/myresource
|
||
status: 406
|
||
response_strings:
|
||
- 406 Not Acceptable
|
||
|
||
- name: myresource resource complex accept
|
||
desc: failover accept media type appropriately
|
||
request_headers:
|
||
accept: text/plain, application/json; q=0.8
|
||
GET: /v1/resource/myresource
|
||
status: 200
|
||
|
||
- name: post myresource resource
|
||
POST: /v1/resource/myresource
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
id: 2ae35573-7f9f-4bb1-aae8-dad8dff5706e
|
||
user_id: 126204ef-989a-46fd-999b-ee45c8108f31
|
||
project_id: 98e785d7-9487-4159-8ab8-8230ec37537a
|
||
display_name: myvm
|
||
metrics:
|
||
vcpus:
|
||
archive_policy_name: gabbilive
|
||
status: 201
|
||
response_json_paths:
|
||
$.id: 2ae35573-7f9f-4bb1-aae8-dad8dff5706e
|
||
$.user_id: 126204ef-989a-46fd-999b-ee45c8108f31
|
||
$.project_id: 98e785d7-9487-4159-8ab8-8230ec37537a
|
||
$.display_name: "myvm"
|
||
|
||
- name: get myresource resource
|
||
GET: $LOCATION
|
||
status: 200
|
||
response_json_paths:
|
||
$.id: 2ae35573-7f9f-4bb1-aae8-dad8dff5706e
|
||
$.user_id: 126204ef-989a-46fd-999b-ee45c8108f31
|
||
$.project_id: 98e785d7-9487-4159-8ab8-8230ec37537a
|
||
$.display_name: "myvm"
|
||
|
||
- name: search for myresource resource via user_id
|
||
POST: /v1/search/resource/myresource
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
=:
|
||
user_id: "126204ef-989a-46fd-999b-ee45c8108f31"
|
||
response_json_paths:
|
||
$..id: 2ae35573-7f9f-4bb1-aae8-dad8dff5706e
|
||
$..user_id: 126204ef-989a-46fd-999b-ee45c8108f31
|
||
$..project_id: 98e785d7-9487-4159-8ab8-8230ec37537a
|
||
$..display_name: myvm
|
||
|
||
- name: search for myresource resource via user_id and 'generic' type
|
||
POST: /v1/search/resource/generic
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
=:
|
||
id: "2ae35573-7f9f-4bb1-aae8-dad8dff5706e"
|
||
response_strings:
|
||
- '"user_id": "126204ef-989a-46fd-999b-ee45c8108f31"'
|
||
|
||
- name: search for myresource resource via user_id and project_id
|
||
POST: /v1/search/resource/generic
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
and:
|
||
- =:
|
||
user_id: "126204ef-989a-46fd-999b-ee45c8108f31"
|
||
- =:
|
||
project_id: "98e785d7-9487-4159-8ab8-8230ec37537a"
|
||
response_strings:
|
||
- '"id": "2ae35573-7f9f-4bb1-aae8-dad8dff5706e"'
|
||
|
||
- name: patch myresource resource
|
||
PATCH: /v1/resource/myresource/2ae35573-7f9f-4bb1-aae8-dad8dff5706e
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
display_name: myvm2
|
||
status: 200
|
||
response_json_paths:
|
||
display_name: myvm2
|
||
|
||
- name: post some measures to the metric on myresource
|
||
POST: /v1/resource/myresource/2ae35573-7f9f-4bb1-aae8-dad8dff5706e/metric/vcpus/measures
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
- timestamp: "2015-03-06T14:33:57"
|
||
value: 2
|
||
- timestamp: "2015-03-06T14:34:12"
|
||
value: 2
|
||
status: 202
|
||
|
||
- name: get myresource measures with poll
|
||
GET: /v1/resource/myresource/2ae35573-7f9f-4bb1-aae8-dad8dff5706e/metric/vcpus/measures
|
||
# wait up to 60 seconds before policy is deleted
|
||
poll:
|
||
count: 60
|
||
delay: 1
|
||
response_json_paths:
|
||
$[0][2]: 2
|
||
$[1][2]: 2
|
||
|
||
- name: post some more measures to the metric on myresource
|
||
POST: /v1/resource/myresource/2ae35573-7f9f-4bb1-aae8-dad8dff5706e/metric/vcpus/measures
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
- timestamp: "2015-03-06T14:34:15"
|
||
value: 5
|
||
- timestamp: "2015-03-06T14:34:20"
|
||
value: 5
|
||
status: 202
|
||
|
||
- name: get myresource measures with refresh
|
||
GET: /v1/resource/myresource/2ae35573-7f9f-4bb1-aae8-dad8dff5706e/metric/vcpus/measures?refresh=true
|
||
response_json_paths:
|
||
$[0][2]: 2
|
||
$[1][2]: 4
|
||
$[2][2]: 2
|
||
$[3][2]: 2
|
||
$[4][2]: 5
|
||
$[5][2]: 5
|
||
|
||
#
|
||
# Search for resources
|
||
#
|
||
|
||
- name: typo of search
|
||
POST: /v1/search/notexists
|
||
status: 404
|
||
|
||
- name: typo of search in resource
|
||
POST: /v1/search/resource/foobar
|
||
status: 404
|
||
|
||
- name: search with invalid uuid
|
||
POST: /v1/search/resource/generic
|
||
request_headers:
|
||
content-type: application/json
|
||
data:
|
||
=:
|
||
id: "cd9eef"
|
||
status: 200
|
||
response_json_paths:
|
||
$.`len`: 0
|
||
|
||
- name: delete myresource resource
|
||
DELETE: /v1/resource/myresource/2ae35573-7f9f-4bb1-aae8-dad8dff5706e
|
||
status: 204
|
||
|
||
# assert resource is really deleted
|
||
- name: assert resource resource is deleted
|
||
GET: /v1/resource/myresource/2ae35573-7f9f-4bb1-aae8-dad8dff5706e
|
||
status: 404
|
||
|
||
- name: post myresource resource no data
|
||
POST: /v1/resource/myresource
|
||
request_headers:
|
||
content-type: application/json
|
||
status: 400
|
||
|
||
- name: delete single archive policy cleanup
|
||
DELETE: /v1/archive_policy/gabbilive
|
||
poll:
|
||
count: 360
|
||
delay: 1
|
||
status: 204
|
||
|
||
# It really is gone
|
||
|
||
- name: delete our resource type
|
||
DELETE: /v1/resource_type/myresource
|
||
status: 204
|
||
|
||
- name: confirm delete of cleanup
|
||
GET: /v1/archive_policy/gabbilive
|
||
status: 404
|