Change to "monasca-read-only-user" for read only tests
"monasca-read-only-user" is a better name instead of "anotherrole" for read only tempest tests. It's also set by default in api-config.conf Also change test.attr() to decorators.attr() in tempest tests because of the deprecation warning. Change-Id: I05427147e2755bdc6fde483a145258f6fb695356
This commit is contained in:
parent
9b8a7802d2
commit
cb3db853ee
|
@ -1,4 +1,4 @@
|
||||||
# (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
|
# (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
@ -39,7 +39,7 @@ class BaseMonascaTest(tempest.test.BaseTestCase):
|
||||||
force_tenant_isolation=True,
|
force_tenant_isolation=True,
|
||||||
identity_version=auth_version)
|
identity_version=auth_version)
|
||||||
credentials = cls.cred_provider.get_creds_by_roles(
|
credentials = cls.cred_provider.get_creds_by_roles(
|
||||||
['monasca-user', 'anotherrole', 'admin']).credentials
|
['monasca-user', 'monasca-read-only-user', 'admin']).credentials
|
||||||
cls.os = clients.Manager(credentials=credentials)
|
cls.os = clients.Manager(credentials=credentials)
|
||||||
cls.monasca_client = cls.os.monasca_client
|
cls.monasca_client = cls.os.monasca_client
|
||||||
cls.projects_client = cls.os.projects_client
|
cls.projects_client = cls.os.projects_client
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
|
# (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
@ -18,7 +18,7 @@ from monasca_tempest_tests.tests.api import base
|
||||||
from monasca_tempest_tests.tests.api import constants
|
from monasca_tempest_tests.tests.api import constants
|
||||||
from monasca_tempest_tests.tests.api import helpers
|
from monasca_tempest_tests.tests.api import helpers
|
||||||
from tempest.lib.common.utils import data_utils
|
from tempest.lib.common.utils import data_utils
|
||||||
from tempest import test
|
from tempest.lib import decorators
|
||||||
|
|
||||||
MIN_HISTORY = 2
|
MIN_HISTORY = 2
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ class TestAlarmStateHistoryMultipleTransitions(base.BaseMonascaTest):
|
||||||
super(TestAlarmStateHistoryMultipleTransitions, cls).\
|
super(TestAlarmStateHistoryMultipleTransitions, cls).\
|
||||||
resource_cleanup()
|
resource_cleanup()
|
||||||
|
|
||||||
@test.attr(type="gate")
|
@decorators.attr(type="gate")
|
||||||
def test_list_alarm_state_history(self):
|
def test_list_alarm_state_history(self):
|
||||||
# Get the alarm state history for a specific alarm by ID
|
# Get the alarm state history for a specific alarm by ID
|
||||||
resp, response_body = self.monasca_client.list_alarms_state_history()
|
resp, response_body = self.monasca_client.list_alarms_state_history()
|
||||||
|
@ -111,7 +111,7 @@ class TestAlarmStateHistoryMultipleTransitions(base.BaseMonascaTest):
|
||||||
"alarm state history is needed."
|
"alarm state history is needed."
|
||||||
self.fail(error_msg)
|
self.fail(error_msg)
|
||||||
|
|
||||||
@test.attr(type="gate")
|
@decorators.attr(type="gate")
|
||||||
def test_list_alarm_state_history_with_offset_limit(self):
|
def test_list_alarm_state_history_with_offset_limit(self):
|
||||||
# Get the alarm state history for a specific alarm by ID
|
# Get the alarm state history for a specific alarm by ID
|
||||||
resp, response_body = self.monasca_client.list_alarms_state_history()
|
resp, response_body = self.monasca_client.list_alarms_state_history()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
|
# (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
@ -14,11 +14,10 @@
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from tempest.lib.common.utils import data_utils
|
|
||||||
from tempest import test
|
|
||||||
|
|
||||||
from monasca_tempest_tests.tests.api import base
|
from monasca_tempest_tests.tests.api import base
|
||||||
from monasca_tempest_tests.tests.api import helpers
|
from monasca_tempest_tests.tests.api import helpers
|
||||||
|
from tempest.lib.common.utils import data_utils
|
||||||
|
from tempest.lib import decorators
|
||||||
|
|
||||||
WAIT_SECS = 10
|
WAIT_SECS = 10
|
||||||
|
|
||||||
|
@ -63,7 +62,7 @@ class TestAlarmTransitions(base.BaseMonascaTest):
|
||||||
resp, resp_body = self.monasca_client.create_metrics([metric])
|
resp, resp_body = self.monasca_client.create_metrics([metric])
|
||||||
self.assertEqual(204, resp.status)
|
self.assertEqual(204, resp.status)
|
||||||
|
|
||||||
@test.attr(type="gate")
|
@decorators.attr(type="gate")
|
||||||
def test_alarm_max_function(self):
|
def test_alarm_max_function(self):
|
||||||
metric_def = {
|
metric_def = {
|
||||||
'name': data_utils.rand_name("max_test"),
|
'name': data_utils.rand_name("max_test"),
|
||||||
|
@ -91,7 +90,7 @@ class TestAlarmTransitions(base.BaseMonascaTest):
|
||||||
|
|
||||||
self._wait_for_alarm_transition(alarm_id, "ALARM")
|
self._wait_for_alarm_transition(alarm_id, "ALARM")
|
||||||
|
|
||||||
@test.attr(type="gate")
|
@decorators.attr(type="gate")
|
||||||
def test_alarm_max_with_deterministic(self):
|
def test_alarm_max_with_deterministic(self):
|
||||||
metric_def = {
|
metric_def = {
|
||||||
'name': data_utils.rand_name("max_deterministic_test"),
|
'name': data_utils.rand_name("max_deterministic_test"),
|
||||||
|
@ -118,7 +117,7 @@ class TestAlarmTransitions(base.BaseMonascaTest):
|
||||||
|
|
||||||
self._wait_for_alarm_transition(alarm_id, "ALARM")
|
self._wait_for_alarm_transition(alarm_id, "ALARM")
|
||||||
|
|
||||||
@test.attr(type="gate")
|
@decorators.attr(type="gate")
|
||||||
def test_alarm_last_function(self):
|
def test_alarm_last_function(self):
|
||||||
metric_def = {
|
metric_def = {
|
||||||
'name': data_utils.rand_name("last_test"),
|
'name': data_utils.rand_name("last_test"),
|
||||||
|
@ -149,7 +148,7 @@ class TestAlarmTransitions(base.BaseMonascaTest):
|
||||||
|
|
||||||
self._wait_for_alarm_transition(alarm_id, "OK")
|
self._wait_for_alarm_transition(alarm_id, "OK")
|
||||||
|
|
||||||
@test.attr(type="gate")
|
@decorators.attr(type="gate")
|
||||||
def test_alarm_last_with_deterministic(self):
|
def test_alarm_last_with_deterministic(self):
|
||||||
metric_def = {
|
metric_def = {
|
||||||
'name': data_utils.rand_name("last_deterministic_test"),
|
'name': data_utils.rand_name("last_deterministic_test"),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
|
# (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
@ -19,7 +19,7 @@ from monasca_tempest_tests.tests.api import constants
|
||||||
from monasca_tempest_tests.tests.api import helpers
|
from monasca_tempest_tests.tests.api import helpers
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
from tempest.lib.common.utils import data_utils
|
from tempest.lib.common.utils import data_utils
|
||||||
from tempest import test
|
from tempest.lib import decorators
|
||||||
|
|
||||||
NUM_ALARM_DEFINITIONS = 3
|
NUM_ALARM_DEFINITIONS = 3
|
||||||
MIN_HISTORY = 3
|
MIN_HISTORY = 3
|
||||||
|
@ -64,7 +64,7 @@ class TestAlarmsStateHistoryOneTransition(base.BaseMonascaTest):
|
||||||
def resource_cleanup(cls):
|
def resource_cleanup(cls):
|
||||||
super(TestAlarmsStateHistoryOneTransition, cls).resource_cleanup()
|
super(TestAlarmsStateHistoryOneTransition, cls).resource_cleanup()
|
||||||
|
|
||||||
@test.attr(type="gate")
|
@decorators.attr(type="gate")
|
||||||
def test_list_alarms_state_history(self):
|
def test_list_alarms_state_history(self):
|
||||||
resp, response_body = self.monasca_client.list_alarms_state_history()
|
resp, response_body = self.monasca_client.list_alarms_state_history()
|
||||||
self.assertEqual(200, resp.status)
|
self.assertEqual(200, resp.status)
|
||||||
|
@ -83,7 +83,7 @@ class TestAlarmsStateHistoryOneTransition(base.BaseMonascaTest):
|
||||||
'timestamp', 'sub_alarms'])
|
'timestamp', 'sub_alarms'])
|
||||||
== set(element))
|
== set(element))
|
||||||
|
|
||||||
@test.attr(type="gate")
|
@decorators.attr(type="gate")
|
||||||
def test_list_alarms_state_history_with_dimensions(self):
|
def test_list_alarms_state_history_with_dimensions(self):
|
||||||
resp, response_body = self.monasca_client.list_alarms_state_history()
|
resp, response_body = self.monasca_client.list_alarms_state_history()
|
||||||
elements = response_body['elements']
|
elements = response_body['elements']
|
||||||
|
@ -109,7 +109,7 @@ class TestAlarmsStateHistoryOneTransition(base.BaseMonascaTest):
|
||||||
"to test."
|
"to test."
|
||||||
self.fail(error_msg)
|
self.fail(error_msg)
|
||||||
|
|
||||||
@test.attr(type="gate")
|
@decorators.attr(type="gate")
|
||||||
def test_list_alarms_state_history_with_start_time(self):
|
def test_list_alarms_state_history_with_start_time(self):
|
||||||
# 1, get all histories
|
# 1, get all histories
|
||||||
resp, all_response_body = self.monasca_client.\
|
resp, all_response_body = self.monasca_client.\
|
||||||
|
@ -136,7 +136,7 @@ class TestAlarmsStateHistoryOneTransition(base.BaseMonascaTest):
|
||||||
expected_elements.remove(min_element)
|
expected_elements.remove(min_element)
|
||||||
self.assertEqual(expected_elements, selected_elements)
|
self.assertEqual(expected_elements, selected_elements)
|
||||||
|
|
||||||
@test.attr(type="gate")
|
@decorators.attr(type="gate")
|
||||||
def test_list_alarms_state_history_with_end_time(self):
|
def test_list_alarms_state_history_with_end_time(self):
|
||||||
# 1, get all histories
|
# 1, get all histories
|
||||||
resp, all_response_body = self.monasca_client.\
|
resp, all_response_body = self.monasca_client.\
|
||||||
|
@ -163,7 +163,7 @@ class TestAlarmsStateHistoryOneTransition(base.BaseMonascaTest):
|
||||||
expected_elements.remove(max_element)
|
expected_elements.remove(max_element)
|
||||||
self.assertEqual(expected_elements, selected_elements)
|
self.assertEqual(expected_elements, selected_elements)
|
||||||
|
|
||||||
@test.attr(type="gate")
|
@decorators.attr(type="gate")
|
||||||
def test_list_alarms_state_history_with_start_end_time(self):
|
def test_list_alarms_state_history_with_start_end_time(self):
|
||||||
# 1, get all histories
|
# 1, get all histories
|
||||||
resp, all_response_body = self.monasca_client.\
|
resp, all_response_body = self.monasca_client.\
|
||||||
|
@ -190,7 +190,7 @@ class TestAlarmsStateHistoryOneTransition(base.BaseMonascaTest):
|
||||||
# 3. compare #1 and #2
|
# 3. compare #1 and #2
|
||||||
self.assertEqual(all_elements, selected_elements)
|
self.assertEqual(all_elements, selected_elements)
|
||||||
|
|
||||||
@test.attr(type="gate")
|
@decorators.attr(type="gate")
|
||||||
def test_list_alarms_state_history_with_offset_limit(self):
|
def test_list_alarms_state_history_with_offset_limit(self):
|
||||||
resp, response_body = self.monasca_client.list_alarms_state_history()
|
resp, response_body = self.monasca_client.list_alarms_state_history()
|
||||||
elements_set1 = response_body['elements']
|
elements_set1 = response_body['elements']
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
|
# (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
@ -18,7 +18,7 @@ from monasca_tempest_tests.tests.api import base
|
||||||
from monasca_tempest_tests.tests.api import constants
|
from monasca_tempest_tests.tests.api import constants
|
||||||
from monasca_tempest_tests.tests.api import helpers
|
from monasca_tempest_tests.tests.api import helpers
|
||||||
from tempest.lib.common.utils import data_utils
|
from tempest.lib.common.utils import data_utils
|
||||||
from tempest import test
|
from tempest.lib import decorators
|
||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,13 +70,13 @@ class TestMetricsNames(base.BaseMonascaTest):
|
||||||
def resource_cleanup(cls):
|
def resource_cleanup(cls):
|
||||||
super(TestMetricsNames, cls).resource_cleanup()
|
super(TestMetricsNames, cls).resource_cleanup()
|
||||||
|
|
||||||
@test.attr(type='gate')
|
@decorators.attr(type='gate')
|
||||||
def test_list_metrics_names(self):
|
def test_list_metrics_names(self):
|
||||||
resp, response_body = self.monasca_client.list_metrics_names()
|
resp, response_body = self.monasca_client.list_metrics_names()
|
||||||
metric_names = self._verify_response(resp, response_body)
|
metric_names = self._verify_response(resp, response_body)
|
||||||
self.assertEqual(metric_names, self._expected_names_list)
|
self.assertEqual(metric_names, self._expected_names_list)
|
||||||
|
|
||||||
@test.attr(type='gate')
|
@decorators.attr(type='gate')
|
||||||
def test_list_metrics_names_with_dimensions(self):
|
def test_list_metrics_names_with_dimensions(self):
|
||||||
query_params = '?dimensions=' + self._dimensions_param
|
query_params = '?dimensions=' + self._dimensions_param
|
||||||
resp, response_body = self.monasca_client.list_metrics_names(
|
resp, response_body = self.monasca_client.list_metrics_names(
|
||||||
|
@ -85,7 +85,7 @@ class TestMetricsNames(base.BaseMonascaTest):
|
||||||
self.assertEqual(metric_names,
|
self.assertEqual(metric_names,
|
||||||
self._test_metric_names_with_same_dim)
|
self._test_metric_names_with_same_dim)
|
||||||
|
|
||||||
@test.attr(type='gate')
|
@decorators.attr(type='gate')
|
||||||
def test_list_metrics_names_with_limit_offset(self):
|
def test_list_metrics_names_with_limit_offset(self):
|
||||||
resp, response_body = self.monasca_client.list_metrics_names()
|
resp, response_body = self.monasca_client.list_metrics_names()
|
||||||
self.assertEqual(200, resp.status)
|
self.assertEqual(200, resp.status)
|
||||||
|
@ -125,7 +125,7 @@ class TestMetricsNames(base.BaseMonascaTest):
|
||||||
# Get the next set
|
# Get the next set
|
||||||
offset = self._get_offset(response_body)
|
offset = self._get_offset(response_body)
|
||||||
|
|
||||||
@test.attr(type='gate')
|
@decorators.attr(type='gate')
|
||||||
def test_list_metrics_names_with_offset_not_in_metrics_names_list(self):
|
def test_list_metrics_names_with_offset_not_in_metrics_names_list(self):
|
||||||
offset1 = 'tempest-abc'
|
offset1 = 'tempest-abc'
|
||||||
offset2 = 'tempest-name111'
|
offset2 = 'tempest-name111'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
|
# (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from monasca_tempest_tests.tests.api import base
|
from monasca_tempest_tests.tests.api import base
|
||||||
from tempest import test
|
from tempest.lib import decorators
|
||||||
|
|
||||||
|
|
||||||
class TestNotificationMethodType(base.BaseMonascaTest):
|
class TestNotificationMethodType(base.BaseMonascaTest):
|
||||||
|
@ -26,7 +26,7 @@ class TestNotificationMethodType(base.BaseMonascaTest):
|
||||||
def resource_cleanup(cls):
|
def resource_cleanup(cls):
|
||||||
super(TestNotificationMethodType, cls).resource_cleanup()
|
super(TestNotificationMethodType, cls).resource_cleanup()
|
||||||
|
|
||||||
@test.attr(type="gate")
|
@decorators.attr(type="gate")
|
||||||
def test_list_notification_method_type(self):
|
def test_list_notification_method_type(self):
|
||||||
resp, response_body = (self.monasca_client.
|
resp, response_body = (self.monasca_client.
|
||||||
list_notification_method_types())
|
list_notification_method_types())
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP
|
# (C) Copyright 2015,2017 Hewlett Packard Enterprise Development Company LP
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
@ -17,7 +17,7 @@ import datetime
|
||||||
from oslo_serialization import jsonutils as json
|
from oslo_serialization import jsonutils as json
|
||||||
|
|
||||||
from monasca_tempest_tests.tests.api import base
|
from monasca_tempest_tests.tests.api import base
|
||||||
from tempest import test
|
from tempest.lib import decorators
|
||||||
|
|
||||||
|
|
||||||
class TestVersions(base.BaseMonascaTest):
|
class TestVersions(base.BaseMonascaTest):
|
||||||
|
@ -26,7 +26,7 @@ class TestVersions(base.BaseMonascaTest):
|
||||||
def resource_setup(cls):
|
def resource_setup(cls):
|
||||||
super(TestVersions, cls).resource_setup()
|
super(TestVersions, cls).resource_setup()
|
||||||
|
|
||||||
@test.attr(type='gate')
|
@decorators.attr(type='gate')
|
||||||
def test_get_version(self):
|
def test_get_version(self):
|
||||||
resp, response_body = self.monasca_client.get_version()
|
resp, response_body = self.monasca_client.get_version()
|
||||||
self.assertEqual(resp.status, 200)
|
self.assertEqual(resp.status, 200)
|
||||||
|
|
Loading…
Reference in New Issue