Merge "Fix alarm_count with multiple group_by fields from CLI"
This commit is contained in:
commit
cf6be5d8c4
|
@ -380,7 +380,7 @@ class AlarmsCount(alarms_api_v2.AlarmsCountV2API, alarming.Alarming):
|
|||
|
||||
if 'group_by' in query_parms:
|
||||
if not isinstance(query_parms['group_by'], list):
|
||||
query_parms['group_by'] = [query_parms['group_by']]
|
||||
query_parms['group_by'] = query_parms['group_by'].split(',')
|
||||
self._validate_group_by(query_parms['group_by'])
|
||||
|
||||
query_parms['metric_dimensions'] = helpers.get_query_dimensions(req, 'metric_dimensions')
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
# under the License.
|
||||
|
||||
import time
|
||||
import urllib
|
||||
|
||||
from monasca_tempest_tests.tests.api import base
|
||||
from monasca_tempest_tests.tests.api import helpers
|
||||
|
@ -227,7 +228,13 @@ class TestAlarmsCount(base.BaseMonascaTest):
|
|||
if alarm['state'] is 'ALARM' and alarm['severity'] is 'LOW':
|
||||
alarm_low_count += 1
|
||||
|
||||
resp, response_body = self.monasca_client.count_alarms("?group_by=state,severity")
|
||||
# Using urlencode mimics the CLI behavior. Without the urlencode, falcon
|
||||
# treats group_by as a list, with the urlencode it treats group_by as
|
||||
# a string. The API needs to handle both.
|
||||
# test_with_all_group_by_params tests multiple group_by without
|
||||
# urlencode
|
||||
query_params = urllib.urlencode([('group_by', 'state,severity')])
|
||||
resp, response_body = self.monasca_client.count_alarms("?" + query_params)
|
||||
self._verify_counts_format(response_body, group_by=['state', 'severity'])
|
||||
|
||||
def run_count_test(self, query_string):
|
||||
|
|
Loading…
Reference in New Issue