Replace test.attr with decorators.attr

Function 'tempest.test.attr()' has moved to 'tempest.lib.decorators
.attr()' in Pike and will be removed in a future version[1].
This patch replaces the 'tempest.test.attr()' with the 'tempest.lib
.decorators.attr().'

[1] Iaafbb112b6eee458089cc49918359a8a8d0485e2

Change-Id: I66562ad991b86bf3950a945541d7a5b6e0fd20a1
This commit is contained in:
Luong Anh Tuan 2017-05-19 16:37:29 +07:00
parent 4eb1b94349
commit 9b8a7802d2
9 changed files with 343 additions and 343 deletions

View File

@ -17,8 +17,8 @@ import time
import six.moves.urllib.parse as urlparse
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions
from tempest import test
from monasca_tempest_tests.tests.api import base
from monasca_tempest_tests.tests.api import constants
@ -30,7 +30,7 @@ NUM_ALARM_DEFINITIONS = 2
class TestAlarmDefinitions(base.BaseMonascaTest):
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_alarm_definition(self):
# Create an alarm definition
name = data_utils.rand_name('alarm_definition')
@ -43,7 +43,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
self._verify_create_alarm_definitions(resp, response_body,
alarm_definition)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_alarm_definition_with_notification(self):
notification_name = data_utils.rand_name('notification-')
notification_type = 'EMAIL'
@ -76,7 +76,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
self._delete_notification(notification_id)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_alarm_definition_with_multiple_notifications(self):
notification_name1 = data_utils.rand_name('notification-')
notification_type1 = 'EMAIL'
@ -115,7 +115,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
self._delete_notification(notification_id1)
self._delete_notification(notification_id2)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_alarm_definition_with_url_in_expression(self):
notification_name = data_utils.rand_name('notification-')
notification_type = 'EMAIL'
@ -140,7 +140,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
alarm_definition)
self._delete_notification(notification_id)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_create_deterministic_alarm_definition(self):
name = data_utils.rand_name('log.error')
expression = "count(log.error{},deterministic) > 0"
@ -160,7 +160,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
alarm_definition,
deterministic=True)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_create_non_deterministic_alarm_definition_compound_mixed_expr(self):
name = data_utils.rand_name('log.error.and.disk.used_perc')
expression = ('max(disk.used_perc{hostname=node_1}) > 99.0 AND '
@ -181,7 +181,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
alarm_definition,
deterministic=False)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_create_deterministic_alarm_definition_compound_expr(self):
name = data_utils.rand_name('log.error.nodes_1_2')
expression = ('count(log.error{hostname=node_2},deterministic) > 0 '
@ -203,8 +203,8 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
alarm_definition,
deterministic=True)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_alarm_definition_with_special_chars_in_expression(self):
notification_name = data_utils.rand_name('notification-')
notification_type = 'EMAIL'
@ -229,8 +229,8 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
self.monasca_client.create_alarm_definitions,
alarm_definition)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_alarm_definition_with_name_exceeds_max_length(self):
long_name = "x" * (constants.MAX_ALARM_DEFINITION_NAME_LENGTH + 1)
expression = "max(cpu.system_perc) > 0"
@ -240,8 +240,8 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
self.monasca_client.create_alarm_definitions,
alarm_definition)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_alarm_definition_with_description_exceeds_max_length(self):
name = data_utils.rand_name('alarm_definition')
long_description = "x" * (constants.
@ -253,8 +253,8 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
self.monasca_client.create_alarm_definitions,
alarm_definition)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_alarm_definition_with_invalid_severity(self):
invalid_severity = "INVALID"
name = data_utils.rand_name('alarm_definition')
@ -268,8 +268,8 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
self.monasca_client.create_alarm_definitions,
alarm_definition)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_alarm_definition_with_alarm_actions_exceeds_max_length(
self):
name = data_utils.rand_name('alarm_definition')
@ -285,8 +285,8 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
self.monasca_client.create_alarm_definitions,
alarm_definition)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_alarm_definition_with_ok_actions_exceeds_max_length(self):
name = data_utils.rand_name('alarm_definition')
expression = "max(cpu.system_perc) > 0"
@ -301,8 +301,8 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
self.monasca_client.create_alarm_definitions,
alarm_definition)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_alarm_definition_with_undeterm_actions_exceeds_max_length(
self):
name = data_utils.rand_name('alarm_definition')
@ -321,7 +321,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
# List
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarm_definitions(self):
expression = "avg(cpu_utilization{service=compute}) >= 1234"
response_body_list = self._create_alarm_definitions(
@ -337,7 +337,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
links = response_body['links']
self._verify_list_alarm_definitions_links(links)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarm_definitions_with_multibyte_character(self):
name = data_utils.rand_name('_').decode('utf8')
description = ''.decode('utf8')
@ -361,7 +361,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
links = response_body['links']
self._verify_list_alarm_definitions_links(links)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarm_definitions_with_name(self):
name = data_utils.rand_name('alarm_definition')
alarm_definition = helpers.create_alarm_definition(
@ -382,7 +382,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
links = response_body['links']
self._verify_list_alarm_definitions_links(links)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarm_definitions_with_dimensions(self):
# Create an alarm definition with random dimensions
name = data_utils.rand_name('alarm_definition')
@ -406,7 +406,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
links = response_body['links']
self._verify_list_alarm_definitions_links(links)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarm_definitions_with_multiple_dimensions(self):
# Create an alarm definition with random dimensions
name = data_utils.rand_name('alarm_definition')
@ -435,7 +435,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
links = response_body['links']
self._verify_list_alarm_definitions_links(links)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarm_definitions_with_severity(self):
name = data_utils.rand_name('alarm_definition')
expression = 'avg(cpu_utilization) >= 1000'
@ -468,14 +468,14 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
links = response_body['links']
self._verify_list_alarm_definitions_links(links)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_alarm_definitions_by_severity_invalid_severity(self):
query_parms = '?severity=false_severity'
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.list_alarm_definitions, query_parms)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarm_definitions_with_multiple_severity(self):
name = data_utils.rand_name('alarm_definition')
expression = 'avg(cpu_utilization{alarm=severity}) >= 1000'
@ -521,8 +521,8 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
links = response_body['links']
self._verify_list_alarm_definitions_links(links)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_alarm_definitions_by_severity_multiple_values_invalid_severity(self):
query_parms = '?severity=false_severity|MEDIUM'
self.assertRaises(exceptions.UnprocessableEntity,
@ -536,7 +536,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.list_alarm_definitions, query_parms)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_alarm_definitions_sort_by(self):
key = data_utils.rand_name('key')
value = data_utils.rand_name('value')
@ -618,7 +618,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
for i, element in enumerate(response_body['elements']):
self.assertEqual(alarm_definitions[-i - 1]['id'], element['id'])
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_alarm_definitions_multiple_sort_by(self):
key = data_utils.rand_name('key')
value = data_utils.rand_name('value')
@ -656,14 +656,14 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
for i, element in enumerate(response_body['elements']):
self.assertEqual(alarm_definitions[expected_order[i]]['id'], element['id'])
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_list_alarm_definitions_invalid_sort_by(self):
query_parms = '?sort_by=random'
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.list_alarm_definitions, query_parms)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarm_definitions_with_offset_limit(self):
helpers.delete_alarm_definitions(self.monasca_client)
expression = "max(cpu.system_perc) > 0"
@ -704,7 +704,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
# Get
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_get_alarm_definition(self):
response_body_list = self._create_alarm_definitions(
expression=None, number_of_definitions=1)
@ -717,7 +717,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
links = response_body['links']
self._verify_list_alarm_definitions_links(links)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_get_alarm_definition_with_multibyte_character(self):
# Create an alarm definition
name = data_utils.rand_name('_').decode('utf8')
@ -741,7 +741,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
# Update
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_update_alarm_definition(self):
notification_name = data_utils.rand_name('notification-')
notification_type = 'EMAIL'
@ -776,8 +776,8 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
links = response_body['links']
self._verify_list_alarm_definitions_links(links)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_update_alarm_definition_with_a_different_match_by(self):
response_body_list = self._create_alarm_definitions(
expression=None, number_of_definitions=1)
@ -791,8 +791,8 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
description, 'true', updated_match_by, 'LOW', None,
None, None)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_update_alarm_definition_with_no_ok_actions(self):
response_body_list = self._create_alarm_definitions(
expression=None, number_of_definitions=1)
@ -806,7 +806,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
response_body_list[0]['id'], name, expression, description,
'true', updated_match_by, 'LOW', None, None)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_update_notification_in_alarm_definition(self):
notification_name = data_utils.rand_name('notification-')
notification_type = 'EMAIL'
@ -842,7 +842,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
# Patch
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_patch_alarm_definition(self):
response_body_list = self._create_alarm_definitions(
expression=None, number_of_definitions=1)
@ -861,8 +861,8 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
self._verify_update_patch_alarm_definition(response_body, patched_name,
None, None, None)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_patch_alarm_definition_with_a_different_match_by(self):
response_body_list = self._create_alarm_definitions(
expression=None, number_of_definitions=1)
@ -873,7 +873,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
id=response_body_list[0]['id'],
match_by=patched_match_by)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_patch_actions_in_alarm_definition(self):
notification_name = data_utils.rand_name('notification-')
notification_type = 'EMAIL'
@ -909,8 +909,8 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
None, notification_id)
self._delete_notification(notification_id)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_patch_alarm_definition_with_invalid_actions(self):
response_body_list = self._create_alarm_definitions(
expression=None, number_of_definitions=1)
@ -932,7 +932,7 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
# Delete
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_and_delete_alarm_definition(self):
response_body_list = self._create_alarm_definitions(
expression=None, number_of_definitions=1)
@ -952,30 +952,30 @@ class TestAlarmDefinitions(base.BaseMonascaTest):
self.fail("Failed test_create_and_delete_alarm_definition: "
"cannot find the alarm definition just created.")
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_get_alarm_defintion_with_invalid_id(self):
def_id = data_utils.rand_name()
self.assertRaises(exceptions.NotFound,
self.monasca_client.get_alarm_definition, def_id)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_delete_alarm_defintion_with_invalid_id(self):
def_id = data_utils.rand_name()
self.assertRaises(exceptions.NotFound,
self.monasca_client.delete_alarm_definition, def_id)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_patch_alarm_defintion_with_invalid_id(self):
def_id = data_utils.rand_name()
self.assertRaises(exceptions.NotFound,
self.monasca_client.patch_alarm_definition,
id=def_id, name='Test')
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_update_alarm_defintion_with_invalid_id(self):
def_id = data_utils.rand_name()

View File

@ -21,8 +21,8 @@ from monasca_tempest_tests.tests.api import base
from monasca_tempest_tests.tests.api import constants
from monasca_tempest_tests.tests.api import helpers
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions
from tempest import test
class TestAlarms(base.BaseMonascaTest):
@ -35,7 +35,7 @@ class TestAlarms(base.BaseMonascaTest):
def resource_cleanup(cls):
super(TestAlarms, cls).resource_cleanup()
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms(self):
alarm_definition_ids, expected_metric \
= self._create_alarms_for_test_alarms(num=1)
@ -50,7 +50,7 @@ class TestAlarms(base.BaseMonascaTest):
self.fail("Failed test_list_alarms: cannot find the alarm just "
"created.")
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms_by_alarm_definition_id(self):
alarm_definition_ids, expected_metric \
= self._create_alarms_for_test_alarms(num=1)
@ -62,7 +62,7 @@ class TestAlarms(base.BaseMonascaTest):
metric = element['metrics'][0]
self._verify_metric_in_alarm(metric, expected_metric)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms_by_metric_name(self):
alarm_definition_ids, expected_metric \
= self._create_alarms_for_test_alarms(num=1)
@ -76,7 +76,7 @@ class TestAlarms(base.BaseMonascaTest):
self.assertEqual(alarm_definition_ids[0], element[
'alarm_definition']['id'])
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms_by_metric_dimensions(self):
alarm_definition_ids, expected_metric \
= self._create_alarms_for_test_alarms(num=1)
@ -92,23 +92,23 @@ class TestAlarms(base.BaseMonascaTest):
self.assertEqual(alarm_definition_ids[0],
element['alarm_definition']['id'])
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_alarms_by_metric_dimensions_key_exceeds_max_length(self):
key = 'x' * (constants.MAX_ALARM_METRIC_DIMENSIONS_KEY_LENGTH + 1)
query_parms = '?metric_dimensions=' + key
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.list_alarms, query_parms)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_alarms_by_metric_dimensions_value_exceeds_max_length(self):
value = 'x' * (constants.MAX_ALARM_METRIC_DIMENSIONS_VALUE_LENGTH + 1)
query_parms = '?metric_dimensions=key:' + value
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.list_alarms, query_parms)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms_by_multiple_metric_dimensions(self):
metric = helpers.create_metric(
name=data_utils.rand_name("multi-dimension"),
@ -145,7 +145,7 @@ class TestAlarms(base.BaseMonascaTest):
self.assertEqual(alarm_def_id,
element['alarm_definition']['id'])
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms_by_metric_dimensions_no_value(self):
metric_name = data_utils.rand_name('metric')
match_by_key = data_utils.rand_name('key')
@ -193,7 +193,7 @@ class TestAlarms(base.BaseMonascaTest):
self.assertIn(metric_2['dimensions'], dimension_sets)
self.assertNotIn(metric_3['dimensions'], dimension_sets)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms_by_metric_dimensions_multi_value(self):
metric_name = data_utils.rand_name('metric')
match_by_key = data_utils.rand_name('key')
@ -238,7 +238,7 @@ class TestAlarms(base.BaseMonascaTest):
self.assertIn(metric_2['dimensions'], dimension_sets)
self.assertNotIn(metric_3['dimensions'], dimension_sets)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms_by_state(self):
helpers.delete_alarm_definitions(self.monasca_client)
self._create_alarms_for_test_alarms(num=3)
@ -261,7 +261,7 @@ class TestAlarms(base.BaseMonascaTest):
self.assertEqual(200, resp.status)
self.assertEqual(len0, len1 + len2 + len3)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms_by_severity(self):
metric_name = data_utils.rand_name("severity-metric")
alarm_defs = []
@ -319,14 +319,14 @@ class TestAlarms(base.BaseMonascaTest):
for alarm in response_body['elements']:
self.assertEqual('CRITICAL', alarm['alarm_definition']['severity'])
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_alarms_by_severity_invalid_severity(self):
query_parms = '?severity=false_severity'
self.assertRaises(exceptions.UnprocessableEntity, self.monasca_client.list_alarms,
query_parms)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms_by_severity_multiple_values(self):
metric_name = data_utils.rand_name("severity-metric")
alarm_defs = []
@ -378,8 +378,8 @@ class TestAlarms(base.BaseMonascaTest):
for alarm in response_body['elements']:
self.assertIn(alarm['alarm_definition']['severity'], ['HIGH', 'CRITICAL'])
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_alarms_by_severity_multiple_values_invalid_severity(self):
query_parms = '?severity=false_severity|MEDIUM'
self.assertRaises(exceptions.UnprocessableEntity, self.monasca_client.list_alarms,
@ -393,7 +393,7 @@ class TestAlarms(base.BaseMonascaTest):
self.assertRaises(exceptions.UnprocessableEntity, self.monasca_client.list_alarms,
query_parms)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms_by_lifecycle_state(self):
alarm_definition_ids, expected_metric \
= self._create_alarms_for_test_alarms(num=1)
@ -413,7 +413,7 @@ class TestAlarms(base.BaseMonascaTest):
self.assertEqual(alarm_definition_ids[0],
element['alarm_definition']['id'])
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms_by_link(self):
alarm_definition_ids, expected_metric \
= self._create_alarms_for_test_alarms(num=1)
@ -433,7 +433,7 @@ class TestAlarms(base.BaseMonascaTest):
self.assertEqual(alarm_definition_ids[0],
element['alarm_definition']['id'])
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms_by_state_updated_start_time(self):
alarm_definition_ids, expected_metric \
= self._create_alarms_for_test_alarms(num=1)
@ -455,7 +455,7 @@ class TestAlarms(base.BaseMonascaTest):
self.assertEqual(alarm_definition_ids[0],
element['alarm_definition']['id'])
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms_by_offset_limit(self):
definition_ids, expected_metric = self._create_alarms_for_test_alarms(num=3)
resp, response_body = self.monasca_client.list_alarms('?metric_name=' + expected_metric['name'])
@ -482,7 +482,7 @@ class TestAlarms(base.BaseMonascaTest):
self.assertEqual(str(offset + limit), next_offset)
self.assertEqual(str(limit), next_limit)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_get_alarm(self):
alarm_definition_ids, expected_metric \
= self._create_alarms_for_test_alarms(num=1)
@ -497,7 +497,7 @@ class TestAlarms(base.BaseMonascaTest):
metric = element['metrics'][0]
self._verify_metric_in_alarm(metric, expected_metric)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms_sort_by(self):
alarm_definition_ids, expected_metric = self._create_alarms_for_test_alarms(num=3)
resp, response_body = self.monasca_client.list_alarms('?metric_name=' + expected_metric['name'])
@ -558,7 +558,7 @@ class TestAlarms(base.BaseMonascaTest):
sort_by_field)
last_sort_by = sort_by_field
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_alarms_sort_by_asc_desc(self):
alarm_definition_ids, expected_metric = self._create_alarms_for_test_alarms(num=3)
resp, response_body = self.monasca_client.list_alarms('?metric_name=' + expected_metric['name'])
@ -593,7 +593,7 @@ class TestAlarms(base.BaseMonascaTest):
element['created_timestamp'])
last_timestamp = element['created_timestamp']
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms_sort_by_offset_limit(self):
metric_1 = {'name': data_utils.rand_name('sorting-metric-1'),
'dimensions': {
@ -661,20 +661,20 @@ class TestAlarms(base.BaseMonascaTest):
elements = response_body['elements']
self.assertEqual(2, len(elements))
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms_invalid_sort_by(self):
query_parms = '?sort_by=not_valid_field'
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.list_alarms, query_parms)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_get_alarm_with_invalid_id(self):
alarm_id = data_utils.rand_name()
self.assertRaises(exceptions.NotFound, self.monasca_client.get_alarm,
alarm_id)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_update_alarm(self):
alarm_definition_ids, expected_metric \
= self._create_alarms_for_test_alarms(num=1)
@ -700,7 +700,7 @@ class TestAlarms(base.BaseMonascaTest):
self.assertEqual(updated_lifecycle_state, element['lifecycle_state'])
self.assertEqual(updated_link, element['link'])
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_patch_alarm(self):
alarm_definition_ids, expected_metric \
= self._create_alarms_for_test_alarms(num=1)
@ -720,7 +720,7 @@ class TestAlarms(base.BaseMonascaTest):
expect_num_elements=1)
self.assertEqual(patch_link, response_body['elements'][0]['link'])
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_delete_alarm(self):
alarm_definition_ids, expected_metric \
= self._create_alarms_for_test_alarms(num=1)
@ -735,23 +735,23 @@ class TestAlarms(base.BaseMonascaTest):
self._verify_list_alarms_elements(resp, response_body,
expect_num_elements=0)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_delete_alarm_with_invalid_id(self):
id = data_utils.rand_name()
self.assertRaises(exceptions.NotFound,
self.monasca_client.delete_alarm, id)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_patch_alarm_with_invalid_id(self):
id = data_utils.rand_name()
self.assertRaises(exceptions.NotFound,
self.monasca_client.patch_alarm, id=id,
lifecycle_state="OPEN")
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_update_alarm_with_invalid_id(self):
alarm_id = data_utils.rand_name()
updated_state = "ALARM"
@ -763,7 +763,7 @@ class TestAlarms(base.BaseMonascaTest):
lifecycle_state=updated_lifecycle_state,
link=updated_link)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_alarms_with_match_by(self):
# Create an alarm definition with no match_by
name = data_utils.rand_name('alarm_definition_1')
@ -806,7 +806,7 @@ class TestAlarms(base.BaseMonascaTest):
self.assertEqual(len(elements[1]['metrics']), 1)
self.assertNotEqual(elements[0]['metrics'], elements[1]['metrics'])
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_alarms_with_sub_expressions_and_match_by(self):
# Create an alarm definition with sub-expressions and match_by
name = data_utils.rand_name('alarm_definition_3')
@ -837,7 +837,7 @@ class TestAlarms(base.BaseMonascaTest):
self.assertEqual(hostnames[2], hostnames[3])
self.assertNotEqual(hostnames[0], hostnames[2])
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_alarms_with_match_by_list(self):
# Create an alarm definition with match_by as a list
name = data_utils.rand_name('alarm_definition')
@ -866,7 +866,7 @@ class TestAlarms(base.BaseMonascaTest):
if i != j:
self.assertNotEqual(dimensions[i], dimensions[j])
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_verify_deterministic_alarm(self):
metric_name = data_utils.rand_name('log.fancy')
metric_dimensions = {'service': 'monitoring',

View File

@ -18,8 +18,8 @@ import urllib
from monasca_tempest_tests.tests.api import base
from monasca_tempest_tests.tests.api import helpers
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions
from tempest import test
GROUP_BY_ALLOWED_PARAMS = {'alarm_definition_id', 'name', 'state', 'severity',
@ -182,7 +182,7 @@ class TestAlarmsCount(base.BaseMonascaTest):
self.assertEqual(len(expected_columns), len(response_body['counts'][i]))
# test with no params
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_count(self):
resp, response_body = self.monasca_client.count_alarms()
self.assertEqual(200, resp.status)
@ -190,7 +190,7 @@ class TestAlarmsCount(base.BaseMonascaTest):
self.assertEqual(250, response_body['counts'][0][0])
# test with each group_by parameter singularly
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_group_by_singular(self):
resp, response_body = self.monasca_client.list_alarms("?state=ALARM")
self.assertEqual(200, resp.status)
@ -213,14 +213,14 @@ class TestAlarmsCount(base.BaseMonascaTest):
self._verify_counts_format(response_body, group_by=['name'], expected_length=4)
# test with group by a parameter that is not allowed
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_group_by_not_allowed(self):
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.count_alarms, "?group_by=not_allowed")
# test with a few group_by fields
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_group_by_multiple(self):
resp, response_body = self.monasca_client.list_alarms()
alarm_low_count = 0
@ -250,27 +250,27 @@ class TestAlarmsCount(base.BaseMonascaTest):
self.assertEqual(expected_count, response_body['counts'][0][0])
# test filter by severity
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_filter_severity(self):
self.run_count_test("?severity=LOW")
# test filter by state
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_filter_state(self):
self.run_count_test("?state=ALARM")
# test filter by metric name
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_filter_metric_name(self):
self.run_count_test("?metric_name=test_metric_01")
# test with multiple metric dimensions
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_filter_multiple_dimensions(self):
self.run_count_test("?metric_dimensions=hostname:test_1,unique:1")
# test with filter and group_by parameters
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_filter_and_group_by_params(self):
resp, response_body = self.monasca_client.list_alarms("?state=ALARM")
self.assertEqual(200, resp.status)
@ -284,7 +284,7 @@ class TestAlarmsCount(base.BaseMonascaTest):
self._verify_counts_format(response_body, group_by=['severity'])
self.assertEqual(expected_count, response_body['counts'][0][0])
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_with_all_group_by_params(self):
resp, response_body = self.monasca_client.list_alarms()
self.assertEqual(200, resp.status)
@ -300,7 +300,7 @@ class TestAlarmsCount(base.BaseMonascaTest):
len(response_body['counts']))
assert expected_num_count <= len(response_body['counts']), msg
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_limit(self):
resp, response_body = self.monasca_client.count_alarms(
"?group_by=metric_name,dimension_name,dimension_value")
@ -316,7 +316,7 @@ class TestAlarmsCount(base.BaseMonascaTest):
group_by=['metric_name', 'dimension_name', 'dimension_value'],
expected_length=1)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_offset(self):
resp, response_body = self.monasca_client.count_alarms(
"?group_by=metric_name,dimension_name,dimension_value")
@ -332,13 +332,13 @@ class TestAlarmsCount(base.BaseMonascaTest):
group_by=['metric_name', 'dimension_name', 'dimension_value'],
expected_length=expected_counts)
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_invalid_offset(self):
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.count_alarms, "?group_by=metric_name&offset=not_an_int")
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_limit_and_offset(self):
resp, response_body = self.monasca_client.count_alarms(
"?group_by=metric_name,dimension_name,dimension_value")

View File

@ -16,8 +16,8 @@ import time
from urllib import urlencode
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions
from tempest import test
from monasca_tempest_tests.tests.api import base
from monasca_tempest_tests.tests.api import constants
@ -87,7 +87,7 @@ class TestDimensions(base.BaseMonascaTest):
def resource_cleanup(cls):
super(TestDimensions, cls).resource_cleanup()
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_dimension_values_without_metric_name(self):
param = '?dimension_name=' + self._dim_names[0]
resp, response_body = self.monasca_client.list_dimension_values(param)
@ -98,7 +98,7 @@ class TestDimensions(base.BaseMonascaTest):
for i in xrange(response_values_length)]
self.assertEqual(values, self._dim_values)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_dimension_values_with_metric_name(self):
parms = '?metric_name=' + self._test_metric1['name']
parms += '&dimension_name=' + self._dim_names[0]
@ -110,7 +110,7 @@ class TestDimensions(base.BaseMonascaTest):
for i in xrange(response_values_length)]
self.assertEqual(values, self._dim_values_for_metric1)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_dimension_values_limit_and_offset(self):
param = '?dimension_name=' + self._dim_names[0]
resp, response_body = self.monasca_client.list_dimension_values(param)
@ -157,13 +157,13 @@ class TestDimensions(base.BaseMonascaTest):
# Get the next set
offset = self._get_offset(response_body)
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_list_dimension_values_no_dimension_name(self):
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.list_dimension_values)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_dimension_names(self):
resp, response_body = self.monasca_client.list_dimension_names()
self.assertEqual(200, resp.status)
@ -173,14 +173,14 @@ class TestDimensions(base.BaseMonascaTest):
in xrange(response_names_length)]
self.assertEqual(names, self._dim_names)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_dimension_names_with_metric_name(self):
self._test_list_dimension_names_with_metric_name(
self._test_metric1['name'], self._dim_names_metric1)
self._test_list_dimension_names_with_metric_name(
self._test_metric2['name'], self._dim_names_metric2)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_dimension_names_limit_and_offset(self):
resp, response_body = self.monasca_client.list_dimension_names()
self.assertEqual(200, resp.status)
@ -225,8 +225,8 @@ class TestDimensions(base.BaseMonascaTest):
# Get the next set
offset = self._get_offset(response_body)
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_list_dimension_names_with_wrong_metric_name(self):
self._test_list_dimension_names_with_metric_name(
'wrong_metric_name', [])

View File

@ -18,8 +18,8 @@ from monasca_tempest_tests.tests.api import base
from monasca_tempest_tests.tests.api import constants
from monasca_tempest_tests.tests.api import helpers
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions
from tempest import test
NUM_MEASUREMENTS = 50
ONE_SECOND = 1000
@ -113,7 +113,7 @@ class TestMeasurements(base.BaseMonascaTest):
cls._start_time = start_time
cls._end_time = end_time
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_measurements(self):
query_parms = '?name=' + str(self._names_list[0]) + \
'&merge_metrics=true' + \
@ -133,22 +133,22 @@ class TestMeasurements(base.BaseMonascaTest):
self._verify_list_measurements_measurement(measurement, i)
i += 1
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_measurements_with_no_start_time(self):
query_parms = '?name=' + str(self._names_list[0])
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.list_measurements, query_parms)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_measurements_with_no_name(self):
query_parms = '?start_time=' + str(self._start_time) + '&end_time=' + \
str(self._end_time)
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.list_measurements, query_parms)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_measurements_with_dimensions(self):
query_parms = '?name=' + self._names_list[0] + '&start_time=' + \
str(self._start_time) + '&end_time=' + \
@ -166,7 +166,7 @@ class TestMeasurements(base.BaseMonascaTest):
self._verify_list_measurements_measurement(
measurement=measurement, test_value=NUM_MEASUREMENTS)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_measurements_with_endtime(self):
time_iso = helpers.timestamp_to_iso(
self._start_timestamp + ONE_SECOND * 2)
@ -184,8 +184,8 @@ class TestMeasurements(base.BaseMonascaTest):
self._verify_list_measurements_meas_len(measurements=measurements,
test_len=NUM_MEASUREMENTS)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_measurements_with_endtime_equals_starttime(self):
query_parms = '?name=' + str(self._names_list[0]) + \
'&merge_metrics=true' \
@ -194,7 +194,7 @@ class TestMeasurements(base.BaseMonascaTest):
self.assertRaises(exceptions.BadRequest,
self.monasca_client.list_measurements, query_parms)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_measurements_with_offset_limit(self):
query_parms = '?name=' + str(self._names_list[1]) + \
'&merge_metrics=true&start_time=' + self._start_time + \
@ -247,7 +247,7 @@ class TestMeasurements(base.BaseMonascaTest):
self.assertEqual(expected_measurements[i],
new_measurements[i])
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_measurements_with_merge_metrics(self):
query_parms = '?name=' + str(self._names_list[0]) + \
'&merge_metrics=true' + \
@ -257,7 +257,7 @@ class TestMeasurements(base.BaseMonascaTest):
query_parms)
self.assertEqual(200, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_measurements_with_group_by_one(self):
query_parms = '?name=' + str(self._names_list[1]) + \
'&group_by=key2' + \
@ -273,7 +273,7 @@ class TestMeasurements(base.BaseMonascaTest):
self.assertEqual(1, len(measurements['dimensions'].keys()))
self.assertEqual([u'key2'], measurements['dimensions'].keys())
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_measurements_with_group_by_multiple(self):
query_parms = '?name=' + str(self._names_list[1]) + \
'&group_by=key2,key3' + \
@ -289,7 +289,7 @@ class TestMeasurements(base.BaseMonascaTest):
self.assertEqual(2, len(measurements['dimensions'].keys()))
self.assertEqual({u'key2', u'key3'}, set(measurements['dimensions'].keys()))
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_measurements_with_group_by_all(self):
query_parms = '?name=' + str(self._names_list[1]) + \
'&group_by=*' + \
@ -302,7 +302,7 @@ class TestMeasurements(base.BaseMonascaTest):
self.assertEqual(len(elements), 4)
self._verify_list_measurements_elements(elements, None, None)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_measurements_with_group_by_and_merge(self):
query_parms = '?name=' + str(self._names_list[1]) + \
'&group_by=*' + \
@ -316,8 +316,8 @@ class TestMeasurements(base.BaseMonascaTest):
self.assertEqual(len(elements), 4)
self._verify_list_measurements_elements(elements, None, None)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_measurements_with_name_exceeds_max_length(self):
long_name = "x" * (constants.MAX_LIST_MEASUREMENTS_NAME_LENGTH + 1)
query_parms = '?name=' + str(long_name) + '&merge_metrics=true' + \
@ -326,8 +326,8 @@ class TestMeasurements(base.BaseMonascaTest):
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.list_measurements, query_parms)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_measurements_with_no_merge_metrics(self):
query_parms = '?name=' + str(self._names_list[0]) + \
'&start_time=' + str(self._start_time) + '&end_time=' \
@ -335,7 +335,7 @@ class TestMeasurements(base.BaseMonascaTest):
self.assertRaises(exceptions.Conflict,
self.monasca_client.list_measurements, query_parms)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_measurements_with_duplicate_query_param_merges_positive(
self):
queries = []
@ -351,8 +351,8 @@ class TestMeasurements(base.BaseMonascaTest):
for i in xrange(2):
self._verify_list_measurements(responses[i][0], responses[i][1])
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_measurements_with_duplicate_query_param_merges_negative(
self):
queries = []

View File

@ -21,8 +21,8 @@ from six.moves import range as xrange
from six.moves import urllib_parse as urlparse
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions
from tempest import test
from monasca_tempest_tests.tests.api import base
from monasca_tempest_tests.tests.api import constants
@ -31,7 +31,7 @@ from monasca_tempest_tests.tests.api import helpers
class TestMetrics(base.BaseMonascaTest):
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_create_metric(self):
name = data_utils.rand_name('name')
key = data_utils.rand_name('key')
@ -73,7 +73,7 @@ class TestMetrics(base.BaseMonascaTest):
"metrics = 0"
self.fail(error_msg)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_create_metric_with_multibyte_character(self):
name = data_utils.rand_name('').decode('utf8')
key = data_utils.rand_name('').decode('utf8')
@ -115,7 +115,7 @@ class TestMetrics(base.BaseMonascaTest):
"metrics = 0"
self.fail(error_msg)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_create_metrics(self):
name = data_utils.rand_name('name')
key = data_utils.rand_name('key')
@ -174,24 +174,24 @@ class TestMetrics(base.BaseMonascaTest):
"metrics = 0"
self.fail(error_msg)
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_create_metric_with_no_name(self):
metric = helpers.create_metric(name=None)
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.create_metrics,
metric)
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_create_metric_with_empty_name(self):
metric = helpers.create_metric(name='')
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.create_metrics,
metric)
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_create_metric_with_empty_value_in_dimensions(self):
name = data_utils.rand_name('name')
metric = helpers.create_metric(name=name,
@ -200,8 +200,8 @@ class TestMetrics(base.BaseMonascaTest):
self.monasca_client.create_metrics,
metric)
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_create_metric_with_empty_key_in_dimensions(self):
name = data_utils.rand_name('name')
metric = helpers.create_metric(name=name,
@ -210,7 +210,7 @@ class TestMetrics(base.BaseMonascaTest):
self.monasca_client.create_metrics,
metric)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_create_metric_with_no_dimensions(self):
name = data_utils.rand_name('name')
timestamp = int(round(time.time() * 1000))
@ -252,7 +252,7 @@ class TestMetrics(base.BaseMonascaTest):
"metrics = 0"
self.fail(error_msg)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_create_metric_with_colon_in_dimension_value(self):
name = data_utils.rand_name('name')
key = 'url'
@ -288,8 +288,8 @@ class TestMetrics(base.BaseMonascaTest):
"metrics = 0"
self.fail(error_msg)
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_create_metric_with_no_timestamp(self):
metric = helpers.create_metric()
metric['timestamp'] = None
@ -297,8 +297,8 @@ class TestMetrics(base.BaseMonascaTest):
self.monasca_client.create_metrics,
metric)
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_create_metric_no_value(self):
timestamp = int(round(time.time() * 1000))
metric = helpers.create_metric(timestamp=timestamp,
@ -307,8 +307,8 @@ class TestMetrics(base.BaseMonascaTest):
self.monasca_client.create_metrics,
metric)
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_create_metric_with_name_exceeds_max_length(self):
long_name = "x" * (constants.MAX_METRIC_NAME_LENGTH + 1)
metric = helpers.create_metric(long_name)
@ -316,8 +316,8 @@ class TestMetrics(base.BaseMonascaTest):
self.monasca_client.create_metrics,
metric)
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_create_metric_with_invalid_chars_in_name(self):
for invalid_char in constants.INVALID_CHARS:
metric = helpers.create_metric(invalid_char)
@ -325,8 +325,8 @@ class TestMetrics(base.BaseMonascaTest):
self.monasca_client.create_metrics,
metric)
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_create_metric_with_invalid_chars_in_dimensions(self):
for invalid_char in constants.INVALID_CHARS:
metric = helpers.create_metric('name-1', {'key-1': invalid_char})
@ -339,8 +339,8 @@ class TestMetrics(base.BaseMonascaTest):
self.monasca_client.create_metrics,
metric)
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_create_metric_dimension_key_exceeds_max_length(self):
long_key = "x" * (constants.MAX_DIMENSION_KEY_LENGTH + 1)
metric = helpers.create_metric('name-1', {long_key: 'value-1'})
@ -348,8 +348,8 @@ class TestMetrics(base.BaseMonascaTest):
self.monasca_client.create_metrics,
metric)
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_create_metric_dimension_value_exceeds_max_length(self):
long_value = "x" * (constants.MAX_DIMENSION_VALUE_LENGTH + 1)
metric = helpers.create_metric('name-1', {'key-1': long_value})
@ -357,8 +357,8 @@ class TestMetrics(base.BaseMonascaTest):
self.monasca_client.create_metrics,
metric)
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_create_metric_with_value_meta_name_exceeds_max_length(self):
long_value_meta_name = "x" * (constants.MAX_VALUE_META_NAME_LENGTH + 1)
value_meta_dict = {long_value_meta_name: "value_meta_value"}
@ -367,8 +367,8 @@ class TestMetrics(base.BaseMonascaTest):
self.monasca_client.create_metrics,
metric)
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_create_metric_with_value_meta_exceeds_max_length(self):
value_meta_name = "x"
long_value_meta_value = "y" * constants.MAX_VALUE_META_TOTAL_LENGTH
@ -378,7 +378,7 @@ class TestMetrics(base.BaseMonascaTest):
self.monasca_client.create_metrics,
metric)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_metrics(self):
resp, response_body = self.monasca_client.list_metrics()
self.assertEqual(200, resp.status)
@ -389,7 +389,7 @@ class TestMetrics(base.BaseMonascaTest):
test_value=None, test_name=None)
self.assertTrue(set(['id', 'name', 'dimensions']) == set(element))
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_metrics_with_dimensions(self):
name = data_utils.rand_name('name')
key = data_utils.rand_name('key')
@ -414,7 +414,7 @@ class TestMetrics(base.BaseMonascaTest):
"metrics = 0"
self.fail(error_msg)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_metrics_dimension_query_multi_value_with_diff_names(self):
metrics, name, key_service, values = \
self._create_metrics_with_different_dimensions(same_name=False)
@ -424,7 +424,7 @@ class TestMetrics(base.BaseMonascaTest):
values[1]
self._verify_dimensions(query_param, metric_dimensions)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_metrics_dimension_query_no_value_with_diff_names(self):
metrics, name, key_service, values = \
self._create_metrics_with_different_dimensions(same_name=False)
@ -433,7 +433,7 @@ class TestMetrics(base.BaseMonascaTest):
query_param = '?dimensions=' + key_service
self._verify_dimensions(query_param, metric_dimensions)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_metrics_dimension_query_multi_value_with_same_name(self):
# Skip the test for now due to InfluxDB Inconsistency
return
@ -445,7 +445,7 @@ class TestMetrics(base.BaseMonascaTest):
values[0] + '|' + values[1]
self._verify_dimensions(query_param, metric_dimensions)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_metrics_dimension_query_no_value_with_same_name(self):
# Skip the test for now due to InfluxDB Inconsistency
return
@ -456,7 +456,7 @@ class TestMetrics(base.BaseMonascaTest):
query_param = '?name=' + name + '&dimensions=' + key_service
self._verify_dimensions(query_param, metric_dimensions)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_metrics_with_name(self):
name = data_utils.rand_name('name')
key = data_utils.rand_name('key')
@ -483,7 +483,7 @@ class TestMetrics(base.BaseMonascaTest):
"metrics = 0"
self.fail(error_msg)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_metrics_with_project(self):
name = data_utils.rand_name('name')
key = data_utils.rand_name('key')
@ -515,7 +515,7 @@ class TestMetrics(base.BaseMonascaTest):
"metrics = 0"
self.fail(error_msg)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_metrics_with_offset_limit(self):
name = data_utils.rand_name()
key1 = data_utils.rand_name()
@ -626,7 +626,7 @@ class TestMetrics(base.BaseMonascaTest):
if test_name is not None:
self.assertEqual(str(element['name']), test_name)
@test.attr(type='gate')
@decorators.attr(type='gate')
def test_list_metrics_with_time_args(self):
name = data_utils.rand_name('name')
key = data_utils.rand_name('key')

View File

@ -20,8 +20,8 @@ from monasca_tempest_tests.tests.api import base
from monasca_tempest_tests.tests.api import constants
from monasca_tempest_tests.tests.api import helpers
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions
from tempest import test
DEFAULT_EMAIL_ADDRESS = 'john.doe@domain.com'
@ -36,7 +36,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
def resource_cleanup(cls):
super(TestNotificationMethods, cls).resource_cleanup()
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_notification_method(self):
notification = helpers.create_notification()
resp, response_body = self.monasca_client.create_notifications(
@ -48,7 +48,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_email_notification_method_with_lower_case_type(self):
notification = helpers.create_notification(name='lower case email notification',
type='email')
@ -61,7 +61,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_email_notification_method_with_mixed_case_type(self):
notification = helpers.create_notification(name='mixed case email notification',
type='EmAil')
@ -74,7 +74,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_notification_method_period_not_defined(self):
notification = helpers.create_notification(period=None)
resp, response_body = self.monasca_client.create_notifications(
@ -86,7 +86,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_webhook_notification_method_with_non_zero_period(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name,
@ -102,7 +102,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_notification_method_webhook_test_tld(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name,
@ -118,7 +118,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_notification_method_webhook_test_tld_and_port(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name,
@ -134,32 +134,32 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_notification_method_with_no_name(self):
notification = helpers.create_notification(name=None)
self.assertRaises((exceptions.BadRequest, exceptions.UnprocessableEntity),
self.monasca_client.create_notifications,
notification)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_notification_method_with_no_type(self):
notification = helpers.create_notification(type=None)
self.assertRaises((exceptions.BadRequest, exceptions.UnprocessableEntity),
self.monasca_client.create_notifications,
notification)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_notification_method_with_no_address(self):
notification = helpers.create_notification(address=None)
self.assertRaises((exceptions.BadRequest, exceptions.UnprocessableEntity),
self.monasca_client.create_notifications,
notification)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_notification_method_with_name_exceeds_max_length(self):
long_name = "x" * (constants.MAX_NOTIFICATION_METHOD_NAME_LENGTH + 1)
notification = helpers.create_notification(name=long_name)
@ -167,8 +167,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.create_notifications,
notification)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_notification_method_with_address_exceeds_max_length(self):
long_address = "x" * (
constants.MAX_NOTIFICATION_METHOD_ADDRESS_LENGTH + 1)
@ -177,16 +177,16 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.create_notifications,
notification)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_notification_method_with_invalid_email_address(self):
notification = helpers.create_notification(address="name@")
self.assertRaises((exceptions.BadRequest, exceptions.UnprocessableEntity),
self.monasca_client.create_notifications,
notification)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_notification_method_with_invalid_scheme_webhook(self):
notification = helpers.create_notification(type="WEBHOOK",
address="ftp://localhost")
@ -194,8 +194,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.create_notifications,
notification)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_notification_method_with_invalid_webhook_address(self):
notification = helpers.create_notification(type="WEBHOOK",
address="localhost:123")
@ -205,7 +205,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
# The below tests are making sure that we accept passing in case insensitive types and that we still validate the
# address if the types are case insensitive
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_notification_method_webhook_with_lower_case_type(self):
notification = helpers.create_notification(type='webhook',
address='http://mytest.test:4533')
@ -218,7 +218,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_notification_method_webhook_with_mixed_case_type(self):
notification = helpers.create_notification(type='webHooK',
address='http://mytest.test:4533')
@ -231,8 +231,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_notification_method_with_invalid_email_address_type_all_lower_case(self):
notification = helpers.create_notification(type="email",
address="name@")
@ -240,8 +240,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.create_notifications,
notification)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_notification_method_with_invalid_email_address_type_all_mixed_case(self):
notification = helpers.create_notification(type="EmAil",
address="name@")
@ -249,8 +249,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.create_notifications,
notification)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_notification_method_with_invalid_webhook_address_type_mixed_case(self):
notification = helpers.create_notification(type="WebHook",
address="localhost:123")
@ -258,8 +258,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.create_notifications,
notification)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_notification_method_with_invalid_webhook_address_type_lower_case(self):
notification = helpers.create_notification(type="webhook",
address="localhost:123")
@ -267,40 +267,40 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.create_notifications,
notification)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_notification_method_with_invalid_type(self):
notification = helpers.create_notification(type='random')
self.assertRaises((exceptions.BadRequest, exceptions.NotFound, exceptions.UnprocessableEntity),
self.monasca_client.create_notifications,
notification)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_notification_method_with_invalid_float_period(self):
notification = helpers.create_notification(period=1.2)
self.assertRaises((exceptions.BadRequest, exceptions.UnprocessableEntity),
self.monasca_client.create_notifications,
notification)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_notification_method_with_invalid_string_period(self):
notification = helpers.create_notification(period='random')
self.assertRaises((exceptions.BadRequest, exceptions.UnprocessableEntity),
self.monasca_client.create_notifications,
notification)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_email_notification_method_with_invalid_non_zero_period(self):
notification = helpers.create_notification(period=60)
self.assertRaises((exceptions.BadRequest, exceptions.UnprocessableEntity),
self.monasca_client.create_notifications,
notification)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_pagerduty_notification_method_with_invalid_non_zero_period(self):
notification = helpers.create_notification(type='PAGERDUTY',
address='test03@localhost',
@ -309,8 +309,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.create_notifications,
notification)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_webhook_notification_method_with_invalid_period(self):
notification = helpers.create_notification(type='WEBHOOK',
address='http://localhost/test01',
@ -319,7 +319,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.create_notifications,
notification)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_notification_methods(self):
notification = helpers.create_notification()
resp, response_body = self.monasca_client.create_notifications(
@ -344,7 +344,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_notification_methods_sort_by(self):
notifications = [helpers.create_notification(
name='notification sort by 01',
@ -414,7 +414,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
for notification in notifications:
self.monasca_client.delete_notification_method(notification['id'])
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_notification_methods_multiple_sort_by(self):
notifications = [helpers.create_notification(
name='notification sort by 01',
@ -449,15 +449,15 @@ class TestNotificationMethods(base.BaseMonascaTest):
for element in response_body['elements']:
self.monasca_client.delete_notification_method(element['id'])
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_notification_methods_invalid_sort_by(self):
query_parms = '?sort_by=random'
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.list_notification_methods,
query_parms)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_notification_methods_with_offset_limit(self):
name1 = data_utils.rand_name('notification')
name2 = data_utils.rand_name('notification')
@ -541,7 +541,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id4)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_get_notification_method(self):
notification = helpers.create_notification()
resp, response_body = self.monasca_client.create_notifications(
@ -554,8 +554,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_get_notification_method_with_invalid_id(self):
notification = helpers.create_notification()
resp, response_body = self.monasca_client.create_notifications(
@ -569,7 +569,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(response_body['id'])
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_update_notification_method_name(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name)
@ -590,7 +590,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_update_notification_method_type(self):
type = 'EMAIL'
notification = helpers.create_notification(type=type)
@ -612,7 +612,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_update_notification_method_address(self):
address = DEFAULT_EMAIL_ADDRESS
notification = helpers.create_notification(address=address)
@ -634,8 +634,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_update_notification_method_name_exceeds_max_length(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name)
@ -653,8 +653,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_update_notification_method_invalid_type(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name)
@ -670,8 +670,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_update_notification_method_address_exceeds_max_length(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name)
@ -689,8 +689,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_update_notification_method_with_no_address(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name)
@ -707,7 +707,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_create_and_delete_notification_method(self):
notification = helpers.create_notification()
resp, response_body = self.monasca_client.create_notifications(
@ -718,8 +718,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_delete_notification_method_with_invalid_id(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name)
@ -734,8 +734,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(response_body['id'])
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_patch_notification_method_with_invalid_id(self):
id = data_utils.rand_name()
name = data_utils.rand_name('notification-')
@ -743,8 +743,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.patch_notification_method,
id, name)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_update_notification_method_with_invalid_id(self):
id = data_utils.rand_name()
name = data_utils.rand_name('notification-')
@ -753,8 +753,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
name=name, type='EMAIL',
address='bob@thebridge.org', period=0)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_update_email_notification_method_with_nonzero_period(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name)
@ -770,8 +770,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_update_webhook_notification_method_to_email_with_nonzero_period(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name,
@ -790,8 +790,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_update_webhook_notification_method_to_pagerduty_with_nonzero_period(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name,
@ -810,8 +810,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_update_notification_method_with_non_int_period(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name)
@ -827,8 +827,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_update_webhook_notification_method_with_invalid_period(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name,
@ -847,7 +847,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_patch_notification_method_name(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name)
@ -865,7 +865,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_patch_notification_method_type(self):
type = 'EMAIL'
notification = helpers.create_notification(type=type)
@ -884,7 +884,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_patch_notification_method_address(self):
address = DEFAULT_EMAIL_ADDRESS
notification = helpers.create_notification(address=address)
@ -902,7 +902,7 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_patch_notification_method_address_period(self):
type = 'WEBHOOK'
notification = helpers.create_notification(
@ -940,8 +940,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_patch_notification_method_name_exceeds_max_length(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name)
@ -958,8 +958,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_patch_notification_method_invalid_type(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name)
@ -973,8 +973,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_patch_notification_method_address_exceeds_max_length(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name)
@ -990,8 +990,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_patch_email_notification_method_with_nonzero_period(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name)
@ -1005,8 +1005,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_patch_webhook_notification_method_to_email_with_nonzero_period(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name,
@ -1023,8 +1023,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_patch_webhook_notification_method_to_pagerduty_with_nonzero_period(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name,
@ -1041,8 +1041,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_patch_notification_method_with_non_int_period(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name)
@ -1056,8 +1056,8 @@ class TestNotificationMethods(base.BaseMonascaTest):
self.monasca_client.delete_notification_method(id)
self.assertEqual(204, resp.status)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_patch_webhook_notification_method_with_invalid_period(self):
name = data_utils.rand_name('notification-')
notification = helpers.create_notification(name=name,

View File

@ -13,8 +13,8 @@
import time
from tempest.lib import decorators
from tempest.lib import exceptions
from tempest import test
from monasca_tempest_tests import clients
from monasca_tempest_tests.tests.api import base
@ -35,7 +35,7 @@ class TestReadOnlyRole(base.BaseMonascaTest):
def resource_cleanup(cls):
super(TestReadOnlyRole, cls).resource_cleanup()
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarms_success(self):
resp, response_body = self.monasca_client.list_alarms()
#
@ -46,7 +46,7 @@ class TestReadOnlyRole(base.BaseMonascaTest):
self.assertEqual(0, len(response_body['elements']))
self.assertTrue(response_body['links'][0]['href'].endswith('/v2.0/alarms'))
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_metrics_success(self):
resp, response_body = self.monasca_client.list_metrics()
#
@ -57,7 +57,7 @@ class TestReadOnlyRole(base.BaseMonascaTest):
self.assertEqual(0, len(response_body['elements']))
self.assertTrue(response_body['links'][0]['href'].endswith('/v2.0/metrics'))
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarm_definition_success(self):
resp, response_body = self.monasca_client.list_alarm_definitions()
#
@ -68,7 +68,7 @@ class TestReadOnlyRole(base.BaseMonascaTest):
self.assertEqual(0, len(response_body['elements']))
self.assertTrue(response_body['links'][0]['href'].endswith('/v2.0/alarm-definitions'))
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_notification_methods_success(self):
resp, response_body = self.monasca_client.list_notification_methods()
#
@ -79,7 +79,7 @@ class TestReadOnlyRole(base.BaseMonascaTest):
self.assertEqual(0, len(response_body['elements']))
self.assertTrue(response_body['links'][0]['href'].endswith('/v2.0/notification-methods'))
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarm_count_success(self):
resp, response_body = self.monasca_client.count_alarms()
#
@ -90,7 +90,7 @@ class TestReadOnlyRole(base.BaseMonascaTest):
self.assertEqual(0, response_body['counts'][0][0])
self.assertTrue(response_body['links'][0]['href'].endswith('/v2.0/alarms/count'))
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_alarm_state_history_success(self):
resp, response_body = self.monasca_client.list_alarms_state_history()
#
@ -101,7 +101,7 @@ class TestReadOnlyRole(base.BaseMonascaTest):
self.assertEqual(0, len(response_body['elements']))
self.assertTrue(response_body['links'][0]['href'].endswith('/v2.0/alarms/state-history'))
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_dimension_values_success(self):
parms = '?dimension_name=foo'
resp, response_body = self.monasca_client.list_dimension_values(parms)
@ -114,7 +114,7 @@ class TestReadOnlyRole(base.BaseMonascaTest):
self.assertEqual(0, len(response_body['elements']))
self.assertTrue(response_body['links'][0]['href'].endswith(url))
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_dimension_names_success(self):
resp, response_body = self.monasca_client.list_dimension_names()
#
@ -126,7 +126,7 @@ class TestReadOnlyRole(base.BaseMonascaTest):
self.assertEqual(0, len(response_body['elements']))
self.assertTrue(response_body['links'][0]['href'].endswith(url))
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_measurements_success(self):
start_timestamp = int(time.time() * 1000)
start_time = str(helpers.timestamp_to_iso(start_timestamp))
@ -140,7 +140,7 @@ class TestReadOnlyRole(base.BaseMonascaTest):
self.assertEqual(0, len(response_body['elements']))
self.assertTrue('/v2.0/metrics/measurements' in response_body['links'][0]['href'])
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_statistics_success(self):
start_timestamp = int(time.time() * 1000)
start_time = str(helpers.timestamp_to_iso(start_timestamp))
@ -155,28 +155,28 @@ class TestReadOnlyRole(base.BaseMonascaTest):
self.assertEqual(0, len(response_body['elements']))
self.assertTrue('/v2.0/metrics/statistics' in response_body['links'][0]['href'])
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_delete_alarms_fails(self):
self.assertRaises(exceptions.Unauthorized,
self.monasca_client.delete_alarm, "foo")
@test.attr(type='gate')
@test.attr(type=['negative'])
@decorators.attr(type='gate')
@decorators.attr(type=['negative'])
def test_create_metric_fails(self):
self.assertRaises(exceptions.Unauthorized,
self.monasca_client.create_metrics,
None)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_alarm_definition_fails(self):
self.assertRaises(exceptions.Unauthorized,
self.monasca_client.create_alarm_definitions,
None)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_create_notification_fails(self):
notif = helpers.create_notification()
self.assertRaises(exceptions.Unauthorized,

View File

@ -20,8 +20,8 @@ from monasca_tempest_tests.tests.api import base
from monasca_tempest_tests.tests.api import constants
from monasca_tempest_tests.tests.api import helpers
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions
from tempest import test
from urllib import urlencode
NUM_MEASUREMENTS = 100
@ -118,7 +118,7 @@ class TestStatistics(base.BaseMonascaTest):
def resource_cleanup(cls):
super(TestStatistics, cls).resource_cleanup()
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_statistics(self):
query_parms = '?name=' + str(self._test_name) + \
'&statistics=' + urlparse.quote('avg,sum,min,max,count') + \
@ -137,8 +137,8 @@ class TestStatistics(base.BaseMonascaTest):
self._verify_column_and_statistics(
column, num_statistics_method, statistics, self.metric_values)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_statistics_with_no_name(self):
query_parms = '?merge_metrics=true&statistics=avg&start_time=' + \
str(self._start_time_iso) + '&end_time=' + \
@ -146,23 +146,23 @@ class TestStatistics(base.BaseMonascaTest):
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.list_statistics, query_parms)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_statistics_with_no_statistics(self):
query_parms = '?name=' + str(self._test_name) + '&start_time=' + str(
self._start_time_iso) + '&end_time=' + str(self._end_time_iso)
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.list_statistics, query_parms)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_statistics_with_no_start_time(self):
query_parms = '?name=' + str(self._test_name) + '&statistics=avg'
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.list_statistics, query_parms)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_statistics_with_invalid_statistics(self):
query_parms = '?name=' + str(self._test_name) + '&statistics=abc' + \
'&start_time=' + str(self._start_time_iso) + \
@ -170,7 +170,7 @@ class TestStatistics(base.BaseMonascaTest):
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.list_statistics, query_parms)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_statistics_with_dimensions(self):
query_parms = '?name=' + str(self._test_name) + '&statistics=avg' \
'&start_time=' + str(self._start_time_iso) + \
@ -183,8 +183,8 @@ class TestStatistics(base.BaseMonascaTest):
dimensions = response_body['elements'][0]['dimensions']
self.assertEqual(dimensions[self._test_key], self._test_value1)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_statistics_with_end_time_equals_start_time(self):
query_parms = '?name=' + str(self._test_name) + \
'&merge_metrics=true&statistics=avg&' \
@ -194,7 +194,7 @@ class TestStatistics(base.BaseMonascaTest):
self.assertRaises(exceptions.BadRequest,
self.monasca_client.list_statistics, query_parms)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_statistics_with_period(self):
query_parms = '?name=' + str(self._test_name) + \
'&merge_metrics=true&statistics=avg&' \
@ -208,7 +208,7 @@ class TestStatistics(base.BaseMonascaTest):
len_statistics = len(response_body['elements'][0]['statistics'])
self.assertEqual(time_diff / 1000, len_statistics)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_statistics_with_offset_limit(self):
start_timestamp = int(time.time() * 1000)
name = data_utils.rand_name()
@ -302,7 +302,7 @@ class TestStatistics(base.BaseMonascaTest):
# Get the next set
offset = self._get_offset(response_body)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_statistics_with_group_by_one(self):
query_parms = '?name=' + self._group_by_metric_name + \
'&group_by=key2' + \
@ -318,7 +318,7 @@ class TestStatistics(base.BaseMonascaTest):
self.assertEqual(1, len(statistics['dimensions'].keys()))
self.assertEqual([u'key2'], statistics['dimensions'].keys())
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_statistics_with_group_by_multiple(self):
query_parms = '?name=' + self._group_by_metric_name + \
'&group_by=key2,key3' + \
@ -334,7 +334,7 @@ class TestStatistics(base.BaseMonascaTest):
self.assertEqual(2, len(statistics['dimensions'].keys()))
self.assertEqual({u'key2', u'key3'}, set(statistics['dimensions'].keys()))
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_statistics_with_group_by_all(self):
query_parms = '?name=' + self._group_by_metric_name + \
'&group_by=*' + \
@ -347,7 +347,7 @@ class TestStatistics(base.BaseMonascaTest):
elements = response_body['elements']
self.assertEqual(len(elements), 4)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_statistics_with_group_by_offset_limit(self):
query_parms = '?name=' + str(self._group_by_metric_name) + \
'&group_by=key2' + \
@ -383,8 +383,8 @@ class TestStatistics(base.BaseMonascaTest):
self.assertEqual(200, resp.status)
self.assertEqual(expected_elements, response_body['elements'])
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_statistics_with_no_merge_metrics(self):
key = data_utils.rand_name('key')
value = data_utils.rand_name('value')
@ -418,8 +418,8 @@ class TestStatistics(base.BaseMonascaTest):
time.sleep(constants.RETRY_WAIT_SECS)
self._check_timeout(i, constants.MAX_RETRIES, elements, 3)
@test.attr(type="gate")
@test.attr(type=['negative'])
@decorators.attr(type="gate")
@decorators.attr(type=['negative'])
def test_list_statistics_with_name_exceeds_max_length(self):
long_name = "x" * (constants.MAX_LIST_STATISTICS_NAME_LENGTH + 1)
query_parms = '?name=' + str(long_name) + '&merge_metrics=true' + \
@ -428,7 +428,7 @@ class TestStatistics(base.BaseMonascaTest):
self.assertRaises(exceptions.UnprocessableEntity,
self.monasca_client.list_statistics, query_parms)
@test.attr(type="gate")
@decorators.attr(type="gate")
def test_list_statistics_response_body_statistic_result_type(self):
query_parms = '?name=' + str(self._test_name) + '&period=100000' + \
'&statistics=avg' + '&merge_metrics=true' + \