/usr/lib/python3/dist-packages/gnocchi/tests/functional/gabbits/search-metric.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 | #
# Test the search API to achieve coverage of just the
# SearchController and SearchMetricController class code.
#
fixtures:
- ConfigFixture
defaults:
request_headers:
# User foobar
authorization: "basic Zm9vYmFyOg=="
content-type: application/json
tests:
- name: create archive policy
desc: for later use
POST: /v1/archive_policy
request_headers:
# User admin
authorization: "basic YWRtaW46"
data:
name: high
definition:
- granularity: 1 second
timespan: 1 hour
- granularity: 2 second
timespan: 1 hour
response_headers:
location: $SCHEME://$NETLOC/v1/archive_policy/high
status: 201
- name: create metric
POST: /v1/metric
data:
archive_policy_name: high
status: 201
- name: post measures
desc: for later use
POST: /v1/batch/metrics/measures
data:
$RESPONSE['$.id']:
- timestamp: "2014-10-06T14:34:12"
value: 12
- timestamp: "2014-10-06T14:34:14"
value: 12
- timestamp: "2014-10-06T14:34:16"
value: 12
- timestamp: "2014-10-06T14:34:18"
value: 12
- timestamp: "2014-10-06T14:34:20"
value: 12
- timestamp: "2014-10-06T14:34:22"
value: 12
- timestamp: "2014-10-06T14:34:24"
value: 12
- timestamp: "2014-10-06T14:34:26"
value: 12
- timestamp: "2014-10-06T14:34:28"
value: 12
- timestamp: "2014-10-06T14:34:30"
value: 12
- timestamp: "2014-10-06T14:34:32"
value: 12
- timestamp: "2014-10-06T14:34:34"
value: 12
status: 202
- name: get metric id
GET: /v1/metric
status: 200
response_json_paths:
$[0].archive_policy.name: high
- name: search with one correct granularity
POST: /v1/search/metric?metric_id=$HISTORY['get metric id'].$RESPONSE['$[0].id']&granularity=1s
data:
"=": 12
status: 200
- name: search with multiple correct granularities
POST: /v1/search/metric?metric_id=$HISTORY['get metric id'].$RESPONSE['$[0].id']&granularity=1second&granularity=2s
data:
"=": 12
status: 200
- name: search with correct and incorrect granularities
POST: /v1/search/metric?metric_id=$HISTORY['get metric id'].$RESPONSE['$[0].id']&granularity=1s&granularity=300
data:
"=": 12
status: 400
request_headers:
accept: application/json
response_json_paths:
$.description.cause: Aggregation does not exist
$.description.detail.granularity: 300
$.description.detail.aggregation_method: mean
- name: search with incorrect granularity
POST: /v1/search/metric?metric_id=$HISTORY['get metric id'].$RESPONSE['$[0].id']&granularity=300
data:
"=": 12
status: 400
request_headers:
accept: application/json
response_json_paths:
$.description.cause: Aggregation does not exist
$.description.detail.granularity: 300
$.description.detail.aggregation_method: mean
- name: search measure with wrong start
POST: /v1/search/metric?metric_id=$HISTORY['get metric id'].$RESPONSE['$[0].id']&start=foobar
data:
∧:
- ≥: 1000
status: 400
response_strings:
- Invalid value for start
- name: create metric 2
POST: /v1/metric
data:
archive_policy_name: "high"
status: 201
- name: search measure with wrong stop
POST: /v1/search/metric?metric_id=$RESPONSE['$.id']&stop=foobar
data:
∧:
- ≥: 1000
status: 400
response_strings:
- Invalid value for stop
|