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: " "rule, should be one of: "
"['gnocchi_aggregation_by_metrics_threshold', " "['gnocchi_aggregation_by_metrics_threshold', "
"'gnocchi_aggregation_by_resources_threshold', " "'gnocchi_aggregation_by_resources_threshold', "
"'gnocchi_resources_threshold', 'threshold']") "'gnocchi_resources_threshold']")
faultstring = response.json['error_message']['faultstring'] faultstring = response.json['error_message']['faultstring']
self.assertEqual(err, faultstring) self.assertEqual(err, faultstring)

View File

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

View File

@ -17,9 +17,12 @@ tests:
content-type: application/json content-type: application/json
data: data:
name: added_alarm_defaults2 name: added_alarm_defaults2
type: threshold type: gnocchi_resources_threshold
threshold_rule: gnocchi_resources_threshold_rule:
meter_name: ameter metric: ameter
resource_id: random_id
resource_type: instance
aggregation_method: max
threshold: 300.0 threshold: 300.0
status: 405 status: 405
response_headers: response_headers:
@ -33,9 +36,12 @@ tests:
data: data:
ok_actions: null ok_actions: null
name: added_alarm_defaults name: added_alarm_defaults
type: threshold type: gnocchi_resources_threshold
threshold_rule: gnocchi_resources_threshold_rule:
meter_name: ameter metric: ameter
resource_id: random_id
resource_type: instance
aggregation_method: max
threshold: 300.0 threshold: 300.0
status: 201 status: 201
response_headers: response_headers:
@ -43,8 +49,8 @@ tests:
content-type: application/json content-type: application/json
response_json_paths: response_json_paths:
$.severity: low $.severity: low
$.threshold_rule.threshold: 300.0 $.gnocchi_resources_threshold_rule.threshold: 300.0
$.threshold_rule.comparison_operator: eq $.gnocchi_resources_threshold_rule.comparison_operator: eq
- name: showAlarm - name: showAlarm
desc: Shows information for a specified alarm. desc: Shows information for a specified alarm.
@ -52,8 +58,8 @@ tests:
response_json_paths: response_json_paths:
$.severity: low $.severity: low
$.alarm_id: $RESPONSE['$.alarm_id'] $.alarm_id: $RESPONSE['$.alarm_id']
$.threshold_rule.threshold: 300.0 $.gnocchi_resources_threshold_rule.threshold: 300.0
$.threshold_rule.comparison_operator: eq $.gnocchi_resources_threshold_rule.comparison_operator: eq
response_headers: response_headers:
content-type: application/json content-type: application/json
@ -64,15 +70,18 @@ tests:
content-type: application/json content-type: application/json
data: data:
name: added_alarm_defaults name: added_alarm_defaults
type: threshold
severity: moderate severity: moderate
threshold_rule: type: gnocchi_resources_threshold
meter_name: ameter gnocchi_resources_threshold_rule:
metric: ameter
resource_id: random_id
resource_type: instance
aggregation_method: max
threshold: 200.0 threshold: 200.0
# TODO(chdent): why do we have a response, why not status: 204? # TODO(chdent): why do we have a response, why not status: 204?
# status: 204 # status: 204
response_json_paths: response_json_paths:
$.threshold_rule.threshold: 200.0 $.gnocchi_resources_threshold_rule.threshold: 200.0
$.severity: moderate $.severity: moderate
$.state: insufficient data $.state: insufficient data

View File

@ -17,9 +17,12 @@ tests:
content-type: application/json content-type: application/json
data: data:
name: added_alarm_defaults2 name: added_alarm_defaults2
type: threshold type: gnocchi_resources_threshold
threshold_rule: gnocchi_resources_threshold_rule:
meter_name: ameter metric: ameter
resource_id: random_id
resource_type: instance
aggregation_method: max
threshold: 300.0 threshold: 300.0
status: 405 status: 405
response_headers: response_headers:
@ -32,9 +35,12 @@ tests:
content-type: application/json content-type: application/json
data: data:
name: added_alarm_defaults name: added_alarm_defaults
type: threshold type: gnocchi_resources_threshold
threshold_rule: gnocchi_resources_threshold_rule:
meter_name: ameter metric: ameter
resource_id: random_id
resource_type: instance
aggregation_method: max
threshold: 300.0 threshold: 300.0
status: 201 status: 201
response_headers: response_headers:
@ -42,8 +48,8 @@ tests:
content-type: application/json content-type: application/json
response_json_paths: response_json_paths:
$.severity: low $.severity: low
$.threshold_rule.threshold: 300.0 $.gnocchi_resources_threshold_rule.threshold: 300.0
$.threshold_rule.comparison_operator: eq $.gnocchi_resources_threshold_rule.comparison_operator: eq
- name: showAlarm - name: showAlarm
desc: Shows information for a specified alarm. desc: Shows information for a specified alarm.
@ -51,8 +57,8 @@ tests:
response_json_paths: response_json_paths:
$.severity: low $.severity: low
$.alarm_id: $RESPONSE['$.alarm_id'] $.alarm_id: $RESPONSE['$.alarm_id']
$.threshold_rule.threshold: 300.0 $.gnocchi_resources_threshold_rule.threshold: 300.0
$.threshold_rule.comparison_operator: eq $.gnocchi_resources_threshold_rule.comparison_operator: eq
response_headers: response_headers:
content-type: application/json content-type: application/json
@ -63,15 +69,18 @@ tests:
content-type: application/json content-type: application/json
data: data:
name: added_alarm_defaults name: added_alarm_defaults
type: threshold
severity: moderate severity: moderate
threshold_rule: type: gnocchi_resources_threshold
meter_name: ameter gnocchi_resources_threshold_rule:
metric: ameter
resource_id: random_id
resource_type: instance
aggregation_method: max
threshold: 200.0 threshold: 200.0
# TODO(chdent): why do we have a response, why not status: 204? # TODO(chdent): why do we have a response, why not status: 204?
# status: 204 # status: 204
response_json_paths: response_json_paths:
$.threshold_rule.threshold: 200.0 $.gnocchi_resources_threshold_rule.threshold: 200.0
$.severity: moderate $.severity: moderate
$.state: insufficient data $.state: insufficient data