deb-aodh/aodh/tests/functional/gabbi/gabbits/alarms.yaml

138 lines
3.3 KiB
YAML

# Requests to cover the basic endpoints for alarms.
fixtures:
- ConfigFixture
tests:
- name: list alarms none
desc: Lists alarms, none yet exist
url: /v2/alarms
method: GET
response_strings:
- "[]"
- name: try to PUT an alarm
desc: what does PUT do
url: /v2/alarms
method: PUT
request_headers:
content-type: application/json
data:
name: added_alarm_defaults2
type: threshold
threshold_rule:
meter_name: ameter
threshold: 300.0
status: 405
response_headers:
allow: GET, POST
- name: createAlarm
desc: Creates an alarm.
url: /v2/alarms
method: POST
request_headers:
content-type: application/json
data:
ok_actions: null
name: added_alarm_defaults
type: threshold
threshold_rule:
meter_name: ameter
threshold: 300.0
status: 201
response_headers:
location: /$SCHEME://$NETLOC/v2/alarms/
content-type: application/json
response_json_paths:
$.severity: low
$.threshold_rule.threshold: 300.0
$.threshold_rule.comparison_operator: eq
- name: showAlarm
desc: Shows information for a specified alarm.
url: /v2/alarms/$RESPONSE['$.alarm_id']
method: GET
response_json_paths:
$.severity: low
$.alarm_id: $RESPONSE['$.alarm_id']
$.threshold_rule.threshold: 300.0
$.threshold_rule.comparison_operator: eq
response_headers:
content-type: application/json
- name: updateAlarm
desc: Updates a specified alarm.
url: /v2/alarms/$RESPONSE['$.alarm_id']
method: PUT
request_headers:
content-type: application/json
data:
name: added_alarm_defaults
type: threshold
severity: moderate
threshold_rule:
meter_name: ameter
threshold: 200.0
# TODO(chdent): why do we have a response, why not status: 204?
# status: 204
response_json_paths:
$.threshold_rule.threshold: 200.0
$.severity: moderate
$.state: insufficient data
- name: showAlarmHistory
desc: Assembles the history for a specified alarm.
url: /v2/alarms/$RESPONSE['$.alarm_id']/history?q.field=type&q.op=eq&q.value=rule%20change
method: GET
response_json_paths:
$[0].type: rule change
- name: updateAlarmState
desc: Sets the state of a specified alarm.
url: /v2/alarms/$RESPONSE['$[0].alarm_id']/state
request_headers:
content-type: application/json
data: '"alarm"'
method: PUT
# TODO(chdent): really? Of what possible use is this?
response_json_paths:
$: alarm
# Get a list of alarms so we can extract an id for the next test
- name: list alarms for data
desc: Lists alarms, only one
url: /v2/alarms
method: GET
response_json_paths:
$[0].name: added_alarm_defaults
- name: showAlarmState
desc: Gets the state of a specified alarm.
url: /v2/alarms/$RESPONSE['$[0].alarm_id']/state
method: GET
response_headers:
content-type: application/json
response_json_paths:
$: alarm
- name: list alarms one
desc: Lists alarms, only one
url: /v2/alarms
method: GET
response_json_paths:
$[0].name: added_alarm_defaults
- name: deleteAlarm
desc: Deletes a specified alarm.
url: /v2/alarms/$RESPONSE['$[0].alarm_id']
method: DELETE
status: 204
- name: list alarms none end
desc: Lists alarms, none now exist
url: /v2/alarms
method: GET
response_strings:
- "[]"