Replaces uuid.uuid4 with uuidutils.generate_uuid()
Openstack common has a wrapper for generating uuids. We should use that function when generating uuids for consistency. Change-Id: I3ea3355a7f04d5b86c8b0b197fcdbe2f0644b191 Closes-Bug: #1082248
This commit is contained in:
@@ -12,8 +12,8 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import uuid
|
|
||||||
|
|
||||||
|
from oslo_utils import uuidutils
|
||||||
from tempest.lib.cli import base
|
from tempest.lib.cli import base
|
||||||
from tempest.lib import exceptions
|
from tempest.lib import exceptions
|
||||||
|
|
||||||
@@ -27,8 +27,8 @@ class AodhClient(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.cli_dir = os.environ.get('AODH_CLIENT_EXEC_DIR')
|
self.cli_dir = os.environ.get('AODH_CLIENT_EXEC_DIR')
|
||||||
self.endpoint = os.environ.get('AODH_ENDPOINT')
|
self.endpoint = os.environ.get('AODH_ENDPOINT')
|
||||||
self.user_id = str(uuid.uuid4())
|
self.user_id = uuidutils.generate_uuid()
|
||||||
self.project_id = str(uuid.uuid4())
|
self.project_id = uuidutils.generate_uuid()
|
||||||
|
|
||||||
def aodh(self, action, flags='', params='',
|
def aodh(self, action, flags='', params='',
|
||||||
fail_ok=False, merge_stderr=False):
|
fail_ok=False, merge_stderr=False):
|
||||||
|
@@ -11,8 +11,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import uuid
|
|
||||||
|
|
||||||
|
from oslo_utils import uuidutils
|
||||||
import requests
|
import requests
|
||||||
import six
|
import six
|
||||||
from tempest.lib import exceptions
|
from tempest.lib import exceptions
|
||||||
@@ -90,12 +90,12 @@ class AodhClientTest(base.ClientTestBase):
|
|||||||
result = self.aodh('alarm', params=params)
|
result = self.aodh('alarm', params=params)
|
||||||
self.assertEqual("", result)
|
self.assertEqual("", result)
|
||||||
|
|
||||||
_test(str(uuid.uuid4()))
|
_test(uuidutils.generate_uuid())
|
||||||
_test('normal-alarm-name')
|
_test('normal-alarm-name')
|
||||||
|
|
||||||
def test_event_scenario(self):
|
def test_event_scenario(self):
|
||||||
|
|
||||||
PROJECT_ID = str(uuid.uuid4())
|
PROJECT_ID = uuidutils.generate_uuid()
|
||||||
|
|
||||||
# CREATE
|
# CREATE
|
||||||
result = self.aodh(u'alarm',
|
result = self.aodh(u'alarm',
|
||||||
@@ -185,7 +185,7 @@ class AodhClientTest(base.ClientTestBase):
|
|||||||
|
|
||||||
def test_threshold_scenario(self):
|
def test_threshold_scenario(self):
|
||||||
|
|
||||||
PROJECT_ID = str(uuid.uuid4())
|
PROJECT_ID = uuidutils.generate_uuid()
|
||||||
|
|
||||||
# CREATE
|
# CREATE
|
||||||
result = self.aodh(u'alarm',
|
result = self.aodh(u'alarm',
|
||||||
@@ -335,7 +335,7 @@ class AodhClientTest(base.ClientTestBase):
|
|||||||
|
|
||||||
def test_composite_scenario(self):
|
def test_composite_scenario(self):
|
||||||
|
|
||||||
project_id = str(uuid.uuid4())
|
project_id = uuidutils.generate_uuid()
|
||||||
# CREATE
|
# CREATE
|
||||||
result = self.aodh(u'alarm',
|
result = self.aodh(u'alarm',
|
||||||
params=(u'create --type composite --name calarm1 '
|
params=(u'create --type composite --name calarm1 '
|
||||||
@@ -503,8 +503,8 @@ class AodhClientGnocchiRulesTest(base.ClientTestBase):
|
|||||||
|
|
||||||
def test_gnocchi_resources_threshold_scenario(self):
|
def test_gnocchi_resources_threshold_scenario(self):
|
||||||
|
|
||||||
PROJECT_ID = str(uuid.uuid4())
|
PROJECT_ID = uuidutils.generate_uuid()
|
||||||
RESOURCE_ID = str(uuid.uuid4())
|
RESOURCE_ID = uuidutils.generate_uuid()
|
||||||
|
|
||||||
req = requests.post(
|
req = requests.post(
|
||||||
os.environ.get("GNOCCHI_ENDPOINT") + "/v1/resource/instance",
|
os.environ.get("GNOCCHI_ENDPOINT") + "/v1/resource/instance",
|
||||||
@@ -629,7 +629,7 @@ class AodhClientGnocchiRulesTest(base.ClientTestBase):
|
|||||||
|
|
||||||
def test_gnocchi_aggr_by_resources_scenario(self):
|
def test_gnocchi_aggr_by_resources_scenario(self):
|
||||||
|
|
||||||
PROJECT_ID = str(uuid.uuid4())
|
PROJECT_ID = uuidutils.generate_uuid()
|
||||||
|
|
||||||
# CREATE
|
# CREATE
|
||||||
result = self.aodh(
|
result = self.aodh(
|
||||||
@@ -722,7 +722,7 @@ class AodhClientGnocchiRulesTest(base.ClientTestBase):
|
|||||||
|
|
||||||
def test_gnocchi_aggr_by_metrics_scenario(self):
|
def test_gnocchi_aggr_by_metrics_scenario(self):
|
||||||
|
|
||||||
PROJECT_ID = str(uuid.uuid4())
|
PROJECT_ID = uuidutils.generate_uuid()
|
||||||
METRIC1 = 'cpu'
|
METRIC1 = 'cpu'
|
||||||
METRIC2 = 'cpu_util'
|
METRIC2 = 'cpu_util'
|
||||||
|
|
||||||
|
@@ -10,9 +10,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import uuid
|
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
from aodhclient.tests.functional import base
|
from aodhclient.tests.functional import base
|
||||||
|
|
||||||
@@ -25,7 +24,7 @@ class AlarmHistoryTest(base.ClientTestBase):
|
|||||||
|
|
||||||
def test_alarm_history_scenario(self):
|
def test_alarm_history_scenario(self):
|
||||||
|
|
||||||
PROJECT_ID = str(uuid.uuid4())
|
PROJECT_ID = uuidutils.generate_uuid()
|
||||||
|
|
||||||
result = self.aodh(u'alarm',
|
result = self.aodh(u'alarm',
|
||||||
params=(u"create --type threshold --name history1 "
|
params=(u"create --type threshold --name history1 "
|
||||||
|
Reference in New Issue
Block a user