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:
parent
fc26f0fc81
commit
a286b162e2
@ -12,8 +12,8 @@
|
||||
|
||||
import os
|
||||
import time
|
||||
import uuid
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
from tempest.lib.cli import base
|
||||
from tempest.lib import exceptions
|
||||
|
||||
@ -27,8 +27,8 @@ class AodhClient(object):
|
||||
def __init__(self):
|
||||
self.cli_dir = os.environ.get('AODH_CLIENT_EXEC_DIR')
|
||||
self.endpoint = os.environ.get('AODH_ENDPOINT')
|
||||
self.user_id = str(uuid.uuid4())
|
||||
self.project_id = str(uuid.uuid4())
|
||||
self.user_id = uuidutils.generate_uuid()
|
||||
self.project_id = uuidutils.generate_uuid()
|
||||
|
||||
def aodh(self, action, flags='', params='',
|
||||
fail_ok=False, merge_stderr=False):
|
||||
|
@ -11,8 +11,8 @@
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
import uuid
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
import requests
|
||||
import six
|
||||
from tempest.lib import exceptions
|
||||
@ -90,12 +90,12 @@ class AodhClientTest(base.ClientTestBase):
|
||||
result = self.aodh('alarm', params=params)
|
||||
self.assertEqual("", result)
|
||||
|
||||
_test(str(uuid.uuid4()))
|
||||
_test(uuidutils.generate_uuid())
|
||||
_test('normal-alarm-name')
|
||||
|
||||
def test_event_scenario(self):
|
||||
|
||||
PROJECT_ID = str(uuid.uuid4())
|
||||
PROJECT_ID = uuidutils.generate_uuid()
|
||||
|
||||
# CREATE
|
||||
result = self.aodh(u'alarm',
|
||||
@ -185,7 +185,7 @@ class AodhClientTest(base.ClientTestBase):
|
||||
|
||||
def test_threshold_scenario(self):
|
||||
|
||||
PROJECT_ID = str(uuid.uuid4())
|
||||
PROJECT_ID = uuidutils.generate_uuid()
|
||||
|
||||
# CREATE
|
||||
result = self.aodh(u'alarm',
|
||||
@ -335,7 +335,7 @@ class AodhClientTest(base.ClientTestBase):
|
||||
|
||||
def test_composite_scenario(self):
|
||||
|
||||
project_id = str(uuid.uuid4())
|
||||
project_id = uuidutils.generate_uuid()
|
||||
# CREATE
|
||||
result = self.aodh(u'alarm',
|
||||
params=(u'create --type composite --name calarm1 '
|
||||
@ -503,8 +503,8 @@ class AodhClientGnocchiRulesTest(base.ClientTestBase):
|
||||
|
||||
def test_gnocchi_resources_threshold_scenario(self):
|
||||
|
||||
PROJECT_ID = str(uuid.uuid4())
|
||||
RESOURCE_ID = str(uuid.uuid4())
|
||||
PROJECT_ID = uuidutils.generate_uuid()
|
||||
RESOURCE_ID = uuidutils.generate_uuid()
|
||||
|
||||
req = requests.post(
|
||||
os.environ.get("GNOCCHI_ENDPOINT") + "/v1/resource/instance",
|
||||
@ -629,7 +629,7 @@ class AodhClientGnocchiRulesTest(base.ClientTestBase):
|
||||
|
||||
def test_gnocchi_aggr_by_resources_scenario(self):
|
||||
|
||||
PROJECT_ID = str(uuid.uuid4())
|
||||
PROJECT_ID = uuidutils.generate_uuid()
|
||||
|
||||
# CREATE
|
||||
result = self.aodh(
|
||||
@ -722,7 +722,7 @@ class AodhClientGnocchiRulesTest(base.ClientTestBase):
|
||||
|
||||
def test_gnocchi_aggr_by_metrics_scenario(self):
|
||||
|
||||
PROJECT_ID = str(uuid.uuid4())
|
||||
PROJECT_ID = uuidutils.generate_uuid()
|
||||
METRIC1 = 'cpu'
|
||||
METRIC2 = 'cpu_util'
|
||||
|
||||
|
@ -10,9 +10,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from aodhclient.tests.functional import base
|
||||
|
||||
@ -25,7 +24,7 @@ class AlarmHistoryTest(base.ClientTestBase):
|
||||
|
||||
def test_alarm_history_scenario(self):
|
||||
|
||||
PROJECT_ID = str(uuid.uuid4())
|
||||
PROJECT_ID = uuidutils.generate_uuid()
|
||||
|
||||
result = self.aodh(u'alarm',
|
||||
params=(u"create --type threshold --name history1 "
|
||||
|
Loading…
Reference in New Issue
Block a user