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
|
#
# Tests for gnocchi-threshold-alarm
#
# user_id : c8ecb587-d38c-426f-a58d-22b8d4a9a1d3
# project_id : 709f6ed6-bfb3-4649-b303-0019a7f6aef2
# alarm name : gabbi-gnocchi-threshold-resource-alarm
# resource_id : gabbi-mock-resource
# archive policy : gabbiliveceph
#
defaults:
request_headers:
x-auth-token: $ENVIRON['ADMIN_TOKEN']
tests:
#
# Setup gnocchi archive policy/resource type/resource/metrics
#
- name: SETUP. create archive policy gabbiliveceph
desc: create archve policy 'gabbiliveceph' for tests
POST: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/archive_policy
# 409 when policy with such name already exists
status: 201 || 409
request_headers:
content-type: application/json
data:
name: gabbiliveceph
back_window: 0
definition:
- granularity: 1 second
points: 60
- granularity: 20 second
timespan: 1 minute
- points: 5
timespan: 5 minute
aggregation_methods:
- mean
- min
- max
- name: check properties of created or existing archive policy
GET: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/archive_policy/gabbiliveceph
status: 200
request_headers:
content-type: application/json
response_json_paths:
$.back_window: 0
$.aggregation_methods.`len`: 3
- name: create resource type ceph_account
desc: needed to create a resource
POST: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/resource_type
status: 201 || 409
request_headers:
content-type: application/json
data:
name: ceph_account
- name: create resource of ceph_account type
POST: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/resource/ceph_account
request_headers:
content-type: application/json
data:
id: 662e46f3-8c06-430c-8a9c-adcaedd1272c
user_id: 27e342e4-4489-424f-a7e4-ba8ed9ad729c
project_id: d6d32769-c351-4758-b0a2-458fa1a065a3
metrics:
radosgw.objects:
archive_policy_name: gabbiliveceph
radosgw.objects.size:
archive_policy_name: gabbiliveceph
radosgw.objects.containers:
archive_policy_name: gabbiliveceph
radosgw.api.request:
archive_policy_name: gabbiliveceph
radosgw.containers.objects:
archive_policy_name: gabbiliveceph
radosgw.containers.objects.size:
archive_policy_name: gabbiliveceph
status: 201
response_json_paths:
$.user_id: 27e342e4-4489-424f-a7e4-ba8ed9ad729c
$.project_id: d6d32769-c351-4758-b0a2-458fa1a065a3
$.metrics.`len`: 6
#
# Actual tests
#
- name: search 'gabbi-gnocchi-threshold-resource-alarm' alarm doesnt exist
desc: search for alarm using user_id, project_id, alarm_name
GET: $ENVIRON['AODH_SERVICE_URL']/v2/alarms
query_parameters:
q.field:
- user_id
- project_id
- name
q.op:
- eq
- eq
- eq
q.value:
- c8ecb587-d38c-426f-a58d-22b8d4a9a1d3
- 709f6ed6-bfb3-4649-b303-0019a7f6aef2
- gabbi-gnocchi-threshold-resource-alarm
method: GET
response_json_paths:
$.`len`: 0
- name: create alarm 'gabbi-gnocchi-threshold-resource-alarm'
desc: create a threshold alarm gabbi-gnocchi-threshold-resource-alarm
POST: $ENVIRON['AODH_SERVICE_URL']/v2/alarms
request_headers:
content-type: application/json
data:
alarm_actions:
- "http://site:8000/gnocchi-threshold-resource"
alarm_id: null
description: An gabbilive threshold based alarm
enabled: true
insufficient_data_actions:
- "http://site:8000/nodata-gnocchi-threshold-resource"
name: "gabbi-gnocchi-threshold-resource-alarm"
ok_actions:
- "http://site:8000/ok-gnocchi-threshold-resource"
project_id: 709f6ed6-bfb3-4649-b303-0019a7f6aef2
repeat_actions: false
severity: moderate
state: "insufficient data"
type: gnocchi_resources_threshold
gnocchi_resources_threshold_rule:
evaluation_periods: 3
metric: "radosgw.objects.size"
resource_id: "662e46f3-8c06-430c-8a9c-adcaedd1272c"
aggregation_method: "mean"
granularity: 60
threshold: 5.0
comparison_operator: "ge"
resource_type: ceph_account
user_id: c8ecb587-d38c-426f-a58d-22b8d4a9a1d3
status: 201
response_json_paths:
$.name: gabbi-gnocchi-threshold-resource-alarm
$.type: gnocchi_resources_threshold
$.user_id: c8ecb587-d38c-426f-a58d-22b8d4a9a1d3
$.project_id: 709f6ed6-bfb3-4649-b303-0019a7f6aef2
$.severity: moderate
- name: retrieve history about 'gabbi-gnocchi-threshold-resource-alarm' creation
desc: get history about alarm creation
GET: $ENVIRON['AODH_SERVICE_URL']/v2/alarms/$RESPONSE['$.alarm_id']/history
request_headers:
content-type: application/json
poll:
count: 5
delay: 2
response_json_paths:
$.`len`: 1
$.[0].type: creation
$.[0].alarm_id: $RESPONSE['$.alarm_id']
- name: update severity for alarm 'gabbi-gnocchi-threshold-resource-alarm'
desc: update severity for alarm gabbi-gnocchi-threshold-resource-alarm
PUT: $ENVIRON['AODH_SERVICE_URL']/v2/alarms/$RESPONSE['$.[0].alarm_id']
status: 200
request_headers:
content-type: application/json
data:
alarm_actions:
- "http://site:8000/gnocchi-threshold-resource"
alarm_id: null
description: An gabbilive threshold based alarm
enabled: true
insufficient_data_actions:
- "http://site:8000/nodata-gnocchi-threshold-resource"
name: "gabbi-gnocchi-threshold-resource-alarm"
ok_actions:
- "http://site:8000/ok-gnocchi-threshold-resource"
project_id: 709f6ed6-bfb3-4649-b303-0019a7f6aef2
repeat_actions: false
severity: low
state: "insufficient data"
type: gnocchi_resources_threshold
gnocchi_resources_threshold_rule:
evaluation_periods: 3
metric: "radosgw.objects.size"
resource_id: "662e46f3-8c06-430c-8a9c-adcaedd1272c"
aggregation_method: "mean"
granularity: 60
threshold: 5.0
comparison_operator: "ge"
resource_type: ceph_account
user_id: c8ecb587-d38c-426f-a58d-22b8d4a9a1d3
response_json_paths:
$.name: gabbi-gnocchi-threshold-resource-alarm
$.type: gnocchi_resources_threshold
$.user_id: c8ecb587-d38c-426f-a58d-22b8d4a9a1d3
$.project_id: 709f6ed6-bfb3-4649-b303-0019a7f6aef2
$.severity: low
$.state: "insufficient data"
- name: retrieve history for 'gabbi-gnocchi-threshold-resource-alarm'
desc: get history for rule_change
GET: $ENVIRON['AODH_SERVICE_URL']/v2/alarms/$RESPONSE['$.alarm_id']/history
request_headers:
content-type: application/json
poll:
count: 5
delay: 2
response_json_paths:
$.`len`: 2
$.[0].type: rule change
$.[0].alarm_id: $RESPONSE['$.alarm_id']
$.[0].detail: '{"severity": "low"}'
- name: update alarm state for 'gabbi-gnocchi-threshold-resource-alarm'
desc: update state for alarm
PUT: $ENVIRON['AODH_SERVICE_URL']/v2/alarms/$RESPONSE['$.[0].alarm_id']/state
request_headers:
content-type: application/json
data: '"ok"'
status: 200
response_strings:
- "ok"
- name: get alarm state for 'gabbi-gnocchi-threshold-resource-alarm'
desc: get state for alarm
GET: $URL
request_headers:
content-type: application/json
status: 200
response_strings:
- "ok"
- name: search 'gabbi-gnocchi-threshold-resource-alarm' alarm exist
desc: search for alarm using user_id, project_id, alarm_name
GET: $ENVIRON['AODH_SERVICE_URL']/v2/alarms
query_parameters:
q.field:
- user_id
- project_id
- name
q.op:
- eq
- eq
- eq
q.value:
- c8ecb587-d38c-426f-a58d-22b8d4a9a1d3
- 709f6ed6-bfb3-4649-b303-0019a7f6aef2
- gabbi-gnocchi-threshold-resource-alarm
poll:
count: 5
delay: 2
response_json_paths:
$.`len`: 1
- name: get info about 'gabbi-gnocchi-threshold-resource-alarm' alarm
desc: access alarm using its ID
GET: $ENVIRON['AODH_SERVICE_URL']/v2/alarms/$RESPONSE['$.[0].alarm_id']
response_json_paths:
$.alarm_id: $RESPONSE['$.[0].alarm_id']
$.alarm_actions: ["http://site:8000/gnocchi-threshold-resource"]
$.name: gabbi-gnocchi-threshold-resource-alarm
$.gnocchi_resources_threshold_rule.resource_id: "662e46f3-8c06-430c-8a9c-adcaedd1272c"
$.gnocchi_resources_threshold_rule.metric: "radosgw.objects.size"
$.gnocchi_resources_threshold_rule.resource_type: "ceph_account"
$.user_id: c8ecb587-d38c-426f-a58d-22b8d4a9a1d3
#
# Teardown
#
- name: CLEANUP. search 'gabbi-gnocchi-threshold-resource' alarm exist
desc: Find alarm id using user_id, project_id, alarm_name
GET: $ENVIRON['AODH_SERVICE_URL']/v2/alarms
query_parameters:
q.field:
- user_id
- project_id
- name
q.op:
- eq
- eq
- eq
q.value:
- c8ecb587-d38c-426f-a58d-22b8d4a9a1d3
- 709f6ed6-bfb3-4649-b303-0019a7f6aef2
- gabbi-gnocchi-threshold-resource-alarm
response_json_paths:
$.`len`: 1
- name: CLEANUP. delete threshold alarm 'gabbi-gnocchi-threshold-resource'
DELETE: $ENVIRON['AODH_SERVICE_URL']/v2/alarms/$RESPONSE['$.[0].alarm_id']
status: 204
- name: CLEANUP. Get resource by name '662e46f3-8c06-430c-8a9c-adcaedd1272c'
desc: retrieve resource by 662e46f3-8c06-430c-8a9c-adcaedd1272c to get its ID
GET: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/resource/generic/662e46f3-8c06-430c-8a9c-adcaedd1272c
status: 200
- name: CLEANUP. delete test ceph_resource '662e46f3-8c06-430c-8a9c-adcaedd1272c'
desc: delete ceph_account resource 662e46f3-8c06-430c-8a9c-adcaedd1272c
DELETE: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/resource/generic/$RESPONSE['$.id']
status: 204
- name: CLEANUP. delete resource type ceph_account
DELETE: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/resource_type/ceph_account
status: 204
- name: CLEANUP. delete archive
DELETE: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/archive_policy/gabbiliveceph
status: 204
xfail: True
|