Files
telemetry-tempest-plugin/telemetry_tempest_plugin/scenario/telemetry_integration_gabbits/aodh-gnocchi-threshold-alarm.yaml
Takashi Kajinami a0e930c17f Use dummy resource type in tests
The `ceph_account` resource type is one of the actual resource types
created by ceilometer, and it should not be deleted after the tests
run. Create a resource type specifically used by tests.

Also retry deletion of the test archive policy because it can't be
deleted until all of the associated measures expire.

Change-Id: I0d423fc89858787fa970c9a38b5a6e40fc985c05
Co-Authored-By: Pavlo Shchelokovskyy <shchelokovskyy@gmail.com>
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
2025-11-17 10:34:53 +00:00

332 lines
12 KiB
YAML

#
# Tests for gnocchi-threshold-alarm
#
# user_id : c8ecb587-d38c-426f-a58d-22b8d4a9a1d3
# project_id : 709f6ed6-bfb3-4649-b303-0019a7f6aef2
# resource type : tempest_test_resource
# resource name : 662e46f3-8c06-430c-8a9c-adcaedd1272c
# archive policy : tempest-test-policy
# alarm name : gabbi-gnocchi-threshold-resource-alarm
#
defaults:
request_headers:
x-auth-token: $ENVIRON['ADMIN_TOKEN']
tests:
#
# Setup gnocchi archive policy/resource type/resource/metrics
#
- name: SETUP. create archive policy tempest-test-policy
desc: create archve policy 'tempest-test-policy' for tests, though it might already be there
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: tempest-test-policy
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/tempest-test-policy
status: 200
request_headers:
content-type: application/json
response_json_paths:
$.back_window: 0
$.aggregation_methods.`len`: 3
- name: create resource type tempest_test_resource
desc: create a resource type so that a resource can be created
POST: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/resource_type
status: 201 || 409
request_headers:
content-type: application/json
data:
name: tempest_test_resource
- name: create resource of tempest_test_resource type
POST: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/resource/tempest_test_resource
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:
tempest.test.metric:
archive_policy_name: tempest-test-policy
status: 201
response_json_paths:
$.user_id: 27e342e4-4489-424f-a7e4-ba8ed9ad729c
$.project_id: d6d32769-c351-4758-b0a2-458fa1a065a3
$.metrics.`len`: 1
#
# 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_strings:
- "[]"
- 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 gnocchi 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: "tempest.test.metric"
resource_id: "662e46f3-8c06-430c-8a9c-adcaedd1272c"
aggregation_method: "mean"
granularity: 60
threshold: 5.0
comparison_operator: "ge"
resource_type: tempest_test_resource
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 gnocchi 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: "tempest.test.metric"
resource_id: "662e46f3-8c06-430c-8a9c-adcaedd1272c"
aggregation_method: "mean"
granularity: 60
threshold: 5.0
comparison_operator: "ge"
resource_type: tempest_test_resource
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: "tempest.test.metric"
$.gnocchi_resources_threshold_rule.resource_type: "tempest_test_resource"
$.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 tempest_test_resource '662e46f3-8c06-430c-8a9c-adcaedd1272c'
desc: delete tempest_test_resource resource 662e46f3-8c06-430c-8a9c-adcaedd1272c
DELETE: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/resource/generic/$RESPONSE['$.id']
status: 204
- name: CLEANUP. verify there's no resources of type tempest_test_resource
GET: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/resource/tempest_test_resource
status: 200
poll:
count: 360
delay: 1
response_strings:
- "[]"
- name: CLEANUP. delete resource type tempest_test_resource
DELETE: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/resource_type/tempest_test_resource
status: 204
- name: CLEANUP. wait until resource type tempest_test_resource is deleted
GET: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/resource_type/tempest_test_resource
status: 404
poll:
count: 360
delay: 1
- name: CLEANUP. delete archive policy
desc: keep trying deleting archive policy, responds 400 until relevant measures expire
DELETE: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/archive_policy/tempest-test-policy
status: 204
poll:
count: 360
delay: 1
- name: CLEANUP. verify archive policy deleted
DELETE: $ENVIRON['GNOCCHI_SERVICE_URL']/v1/archive_policy/tempest-test-policy
status: 404
poll:
count: 360
delay: 1