remove remaining ceilometer threshold references

switch test to use gnocchi_resource_threshold_rule

Change-Id: I87001201fdd496400d56770a2c2d7bdec3c8f052
This commit is contained in:
gord chung 2018-01-22 21:08:05 +00:00
parent 5688e3d314
commit 2faec3270f
4 changed files with 57 additions and 49 deletions

View File

@ -2556,7 +2556,7 @@ class TestAlarmsCompositeRule(TestAlarmsBase):
"rule, should be one of: "
"['gnocchi_aggregation_by_metrics_threshold', "
"'gnocchi_aggregation_by_resources_threshold', "
"'gnocchi_resources_threshold', 'threshold']")
"'gnocchi_resources_threshold']")
faultstring = response.json['error_message']['faultstring']
self.assertEqual(err, faultstring)

View File

@ -81,12 +81,9 @@ class TestApiMiddleware(v2.FunctionalTest):
# Ensure translated messages get placed properly into json faults
with mock.patch.object(i18n, 'translate',
side_effect=self._fake_translate):
response = self.post_json('/alarms', params={'name': 'foobar',
'type': 'threshold'},
expect_errors=True,
headers={"Accept":
"application/json"}
)
response = self.post_json('/alarms', params={
'name': 'foobar', 'type': 'gnocchi_resources_threshold'},
expect_errors=True, headers={"Accept": "application/json"})
self.assertEqual(400, response.status_int)
self.assertEqual("application/json", response.content_type)
self.assertTrue(response.json['error_message'])
@ -116,12 +113,9 @@ class TestApiMiddleware(v2.FunctionalTest):
# Ensure translated messages get placed properly into xml faults
with mock.patch.object(i18n, 'translate',
side_effect=self._fake_translate):
response = self.post_json('/alarms', params={'name': 'foobar',
'type': 'threshold'},
expect_errors=True,
headers={"Accept":
"application/xml,*/*"}
)
response = self.post_json('/alarms', params={
'name': 'foobar', 'type': 'gnocchi_resources_threshold'},
expect_errors=True, headers={"Accept": "application/xml,*/*"})
self.assertEqual(400, response.status_int)
self.assertEqual("application/xml", response.content_type)
self.assertEqual('error_message', response.xml.tag)
@ -133,14 +127,10 @@ class TestApiMiddleware(v2.FunctionalTest):
# Ensure that we are actually invoking language negotiation
with mock.patch.object(i18n, 'translate',
side_effect=self._fake_translate):
response = self.post_json('/alarms', params={'name': 'foobar',
'type': 'threshold'},
expect_errors=True,
headers={"Accept":
"application/xml,*/*",
"Accept-Language":
"en-US"}
)
response = self.post_json('/alarms', params={
'name': 'foobar', 'type': 'gnocchi_resources_threshold'},
expect_errors=True, headers={"Accept": "application/xml,*/*",
"Accept-Language": "en-US"})
self.assertEqual(400, response.status_int)
self.assertEqual("application/xml", response.content_type)

View File

@ -17,9 +17,12 @@ tests:
content-type: application/json
data:
name: added_alarm_defaults2
type: threshold
threshold_rule:
meter_name: ameter
type: gnocchi_resources_threshold
gnocchi_resources_threshold_rule:
metric: ameter
resource_id: random_id
resource_type: instance
aggregation_method: max
threshold: 300.0
status: 405
response_headers:
@ -33,9 +36,12 @@ tests:
data:
ok_actions: null
name: added_alarm_defaults
type: threshold
threshold_rule:
meter_name: ameter
type: gnocchi_resources_threshold
gnocchi_resources_threshold_rule:
metric: ameter
resource_id: random_id
resource_type: instance
aggregation_method: max
threshold: 300.0
status: 201
response_headers:
@ -43,8 +49,8 @@ tests:
content-type: application/json
response_json_paths:
$.severity: low
$.threshold_rule.threshold: 300.0
$.threshold_rule.comparison_operator: eq
$.gnocchi_resources_threshold_rule.threshold: 300.0
$.gnocchi_resources_threshold_rule.comparison_operator: eq
- name: showAlarm
desc: Shows information for a specified alarm.
@ -52,8 +58,8 @@ tests:
response_json_paths:
$.severity: low
$.alarm_id: $RESPONSE['$.alarm_id']
$.threshold_rule.threshold: 300.0
$.threshold_rule.comparison_operator: eq
$.gnocchi_resources_threshold_rule.threshold: 300.0
$.gnocchi_resources_threshold_rule.comparison_operator: eq
response_headers:
content-type: application/json
@ -64,15 +70,18 @@ tests:
content-type: application/json
data:
name: added_alarm_defaults
type: threshold
severity: moderate
threshold_rule:
meter_name: ameter
type: gnocchi_resources_threshold
gnocchi_resources_threshold_rule:
metric: ameter
resource_id: random_id
resource_type: instance
aggregation_method: max
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
$.gnocchi_resources_threshold_rule.threshold: 200.0
$.severity: moderate
$.state: insufficient data

View File

@ -17,9 +17,12 @@ tests:
content-type: application/json
data:
name: added_alarm_defaults2
type: threshold
threshold_rule:
meter_name: ameter
type: gnocchi_resources_threshold
gnocchi_resources_threshold_rule:
metric: ameter
resource_id: random_id
resource_type: instance
aggregation_method: max
threshold: 300.0
status: 405
response_headers:
@ -32,9 +35,12 @@ tests:
content-type: application/json
data:
name: added_alarm_defaults
type: threshold
threshold_rule:
meter_name: ameter
type: gnocchi_resources_threshold
gnocchi_resources_threshold_rule:
metric: ameter
resource_id: random_id
resource_type: instance
aggregation_method: max
threshold: 300.0
status: 201
response_headers:
@ -42,8 +48,8 @@ tests:
content-type: application/json
response_json_paths:
$.severity: low
$.threshold_rule.threshold: 300.0
$.threshold_rule.comparison_operator: eq
$.gnocchi_resources_threshold_rule.threshold: 300.0
$.gnocchi_resources_threshold_rule.comparison_operator: eq
- name: showAlarm
desc: Shows information for a specified alarm.
@ -51,8 +57,8 @@ tests:
response_json_paths:
$.severity: low
$.alarm_id: $RESPONSE['$.alarm_id']
$.threshold_rule.threshold: 300.0
$.threshold_rule.comparison_operator: eq
$.gnocchi_resources_threshold_rule.threshold: 300.0
$.gnocchi_resources_threshold_rule.comparison_operator: eq
response_headers:
content-type: application/json
@ -63,15 +69,18 @@ tests:
content-type: application/json
data:
name: added_alarm_defaults
type: threshold
severity: moderate
threshold_rule:
meter_name: ameter
type: gnocchi_resources_threshold
gnocchi_resources_threshold_rule:
metric: ameter
resource_id: random_id
resource_type: instance
aggregation_method: max
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
$.gnocchi_resources_threshold_rule.threshold: 200.0
$.severity: moderate
$.state: insufficient data