Fix alarm_count with multiple group_by fields from CLI
CLI sends multiple group_by fields with ',' as a separator, but the ',' gets urlencoded. Falcon then treats the group_by parameter as a string instead of a list so 'state,severity' was treated as a single value and failed validation. The fix was to do a split using ','. The tempest tests did not urlencode the ',' so Falcon treated group_by as a list and the tests succeeded even though the same test through the CLI would fail. Created tempest test that shows the failure and that it now works Change-Id: Ice01df6e66c6b019270fed27de08de8ee713114f
This commit is contained in:
parent
13558a14d8
commit
455be80e5f
|
@ -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'])
|
||||
|
||||
# test with filter parameters
|
||||
|
|
Loading…
Reference in New Issue