Replaces uuid.uuid4 with uuidutils.generate_uuid()
Openstack common has a wrapper for generating uuids. We should use that function to generate uuids for consistency. Change-Id: Ie67046af895554eeb0bc1fbdcbbec8878ab6a178
This commit is contained in:
parent
4978f34055
commit
bdc8fadbda
|
@ -14,7 +14,6 @@
|
|||
# under the License.
|
||||
#
|
||||
# Copied from Neutron
|
||||
import uuid
|
||||
|
||||
from cue.common import exception
|
||||
from cue.common.i18n import _ # noqa
|
||||
|
@ -26,6 +25,7 @@ from oslo_db import exception as db_exception
|
|||
from oslo_db import options as db_options
|
||||
from oslo_db.sqlalchemy import session
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
from sqlalchemy.orm import exc as sql_exception
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
@ -105,7 +105,7 @@ class Connection(api.Connection):
|
|||
|
||||
def create_cluster(self, context, cluster_values):
|
||||
if not cluster_values.get('id'):
|
||||
cluster_values['id'] = str(uuid.uuid4())
|
||||
cluster_values['id'] = uuidutils.generate_uuid()
|
||||
|
||||
cluster_values['status'] = models.Status.BUILDING
|
||||
cluster = models.Cluster()
|
||||
|
@ -124,7 +124,7 @@ class Connection(api.Connection):
|
|||
|
||||
for i in range(cluster_values['size']):
|
||||
node = models.Node()
|
||||
node_id = str(uuid.uuid4())
|
||||
node_id = uuidutils.generate_uuid()
|
||||
node_values['id'] = node_id
|
||||
node.update(node_values)
|
||||
node.save(db_session)
|
||||
|
@ -186,7 +186,7 @@ class Connection(api.Connection):
|
|||
|
||||
def create_endpoint(self, context, endpoint_values):
|
||||
if not endpoint_values.get('id'):
|
||||
endpoint_values['id'] = str(uuid.uuid4())
|
||||
endpoint_values['id'] = uuidutils.generate_uuid()
|
||||
|
||||
endpoint = models.Endpoint()
|
||||
endpoint.update(endpoint_values)
|
||||
|
@ -317,4 +317,4 @@ class Connection(api.Connection):
|
|||
raise exception.NotFound(_("Broker was not found"))
|
||||
|
||||
image_id = selected_image['value']
|
||||
return image_id
|
||||
return image_id
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
# Copied from Octavia
|
||||
from cue.db.sqlalchemy import types
|
||||
|
||||
import uuid
|
||||
|
||||
from oslo_db.sqlalchemy import models
|
||||
from oslo_utils import uuidutils
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.ext import declarative
|
||||
|
||||
|
@ -39,7 +39,7 @@ class LookupTableMixin(object):
|
|||
class IdMixin(object):
|
||||
"""Id mixin, add to subclasses that have a tenant."""
|
||||
id = sa.Column(types.UUID(), nullable=False,
|
||||
default=lambda i: str(uuid.uuid4()),
|
||||
default=lambda i: uuidutils.generate_uuid(),
|
||||
primary_key=True)
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import contextlib
|
||||
import uuid
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import uuidutils
|
||||
|
@ -242,7 +241,7 @@ class Client(object):
|
|||
if flow_factory is not None:
|
||||
flow_detail = persistence_models.FlowDetail(
|
||||
job_name,
|
||||
str(uuid.uuid4())
|
||||
uuidutils.generate_uuid()
|
||||
)
|
||||
book.add(flow_detail)
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
Tests for the API /cluster/ controller methods.
|
||||
"""
|
||||
|
||||
import uuid
|
||||
|
||||
from cue.common import validate_auth_token as auth_validate
|
||||
from cue.db.sqlalchemy import api as db_api
|
||||
|
@ -29,6 +28,8 @@ from cue.tests.functional import api
|
|||
from cue.tests.functional.api import api_utils
|
||||
from cue.tests.functional import utils as test_utils
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
|
||||
class TestGetCluster(api.APITest,
|
||||
api_utils.ClusterValidationMixin):
|
||||
|
@ -38,7 +39,7 @@ class TestGetCluster(api.APITest,
|
|||
|
||||
def test_get_cluster_not_found(self):
|
||||
"""test get non-existing cluster."""
|
||||
data = self.get_json('/clusters/' + str(uuid.uuid4()),
|
||||
data = self.get_json('/clusters/' + uuidutils.generate_uuid(),
|
||||
headers=self.auth_headers, expect_errors=True)
|
||||
|
||||
self.assertEqual(404, data.status_code,
|
||||
|
@ -101,7 +102,7 @@ class TestDeleteCluster(api.APITest,
|
|||
|
||||
def test_delete_cluster_not_found(self):
|
||||
"""test delete non-existing cluster."""
|
||||
data = self.delete('/clusters/' + str(uuid.uuid4()),
|
||||
data = self.delete('/clusters/' + uuidutils.generate_uuid(),
|
||||
headers=self.auth_headers, expect_errors=True)
|
||||
|
||||
self.assertEqual(404, data.status_code,
|
||||
|
@ -326,7 +327,8 @@ class TestCreateCluster(api.APITest,
|
|||
def test_create_network_id_size_not_one(self):
|
||||
"""test create a cluster with size of network_id more than one."""
|
||||
api_cluster = test_utils.create_api_test_cluster(network_id=(
|
||||
[str(uuid.uuid4()), str(uuid.uuid4())]))
|
||||
[uuidutils.generate_uuid(),
|
||||
uuidutils.generate_uuid()]))
|
||||
|
||||
data = self.post_json('/clusters', headers=self.auth_headers,
|
||||
params=api_cluster, expect_errors=True)
|
||||
|
|
|
@ -16,10 +16,8 @@
|
|||
# Copyright [2014] Hewlett-Packard Development Company, L.P.
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
import uuid
|
||||
|
||||
from oslo_db import exception as oslo_exception
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from cue.common import exception
|
||||
from cue.db import api as db_api
|
||||
|
@ -28,8 +26,8 @@ from cue.db.sqlalchemy import models
|
|||
from cue.tests.functional import base
|
||||
|
||||
|
||||
UUID1 = str(uuid.uuid4())
|
||||
UUID2 = str(uuid.uuid4())
|
||||
UUID1 = uuidutils.generate_uuid()
|
||||
UUID2 = uuidutils.generate_uuid()
|
||||
|
||||
|
||||
class ApiTests(base.FunctionalTestCase):
|
||||
|
@ -364,4 +362,4 @@ class ApiTests(base.FunctionalTestCase):
|
|||
self.assertRaises(exception.NotFound,
|
||||
self.dbapi.get_image_id_by_broker_name,
|
||||
self.context,
|
||||
"fake mq")
|
||||
"fake mq")
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# under the License.
|
||||
#
|
||||
# Copied from Octavia
|
||||
import uuid
|
||||
|
||||
from cue.db import api as db_api
|
||||
from cue.db.sqlalchemy import api as sql_api
|
||||
|
@ -21,12 +20,12 @@ from cue.db.sqlalchemy import models
|
|||
from cue.tests.functional import base
|
||||
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
|
||||
UUID1 = str(uuid.uuid4())
|
||||
UUID2 = str(uuid.uuid4())
|
||||
UUID3 = str(uuid.uuid4())
|
||||
UUID4 = str(uuid.uuid4())
|
||||
UUID1 = uuidutils.generate_uuid()
|
||||
UUID2 = uuidutils.generate_uuid()
|
||||
UUID3 = uuidutils.generate_uuid()
|
||||
UUID4 = uuidutils.generate_uuid()
|
||||
|
||||
|
||||
class ModelsTests(base.FunctionalTestCase):
|
||||
|
@ -255,4 +254,4 @@ class ModelsTests(base.FunctionalTestCase):
|
|||
"type"
|
||||
"value")
|
||||
self.assertEqual(endpoint_values["deleted"], endpoint_db.deleted,
|
||||
"Invalid deleted value")
|
||||
"Invalid deleted value")
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
from neutronclient.common import exceptions
|
||||
import neutronclient.neutron.client
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
import cue.tests.functional.fixtures.base as base
|
||||
|
||||
|
@ -31,9 +31,9 @@ def new_network_detail(admin_state_up=True,
|
|||
subnets=None,
|
||||
tenant_id=None):
|
||||
if id is None:
|
||||
id = str(uuid.uuid4())
|
||||
id = uuidutils.generate_uuid()
|
||||
if tenant_id is None:
|
||||
tenant_id = str(uuid.uuid4())
|
||||
tenant_id = uuidutils.generate_uuid()
|
||||
return {'admin_state_up': admin_state_up,
|
||||
'id': id,
|
||||
'name': name,
|
||||
|
@ -93,7 +93,7 @@ class NeutronClient(base.BaseFixture):
|
|||
else:
|
||||
body = {'port': {}}
|
||||
|
||||
port_id = str(uuid.uuid4())
|
||||
port_id = uuidutils.generate_uuid()
|
||||
body['port']['id'] = port_id
|
||||
body['port']['fixed_ips'] = []
|
||||
body['port']['fixed_ips'].append({'ip_address': '0.0.0.0'})
|
||||
|
@ -114,7 +114,7 @@ class NeutronClient(base.BaseFixture):
|
|||
else:
|
||||
body = {'network': {}}
|
||||
|
||||
network_id = str(uuid.uuid4())
|
||||
network_id = uuidutils.generate_uuid()
|
||||
body['network'].update({
|
||||
'id': network_id,
|
||||
'subnets': [],
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
# under the License.
|
||||
|
||||
import copy
|
||||
import uuid
|
||||
|
||||
import novaclient.exceptions as nova_exc
|
||||
import novaclient.v2.client as nova_client
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
import cue.client as client
|
||||
import cue.tests.functional.fixtures.base as base
|
||||
|
@ -50,7 +50,7 @@ class ImageDetails(object):
|
|||
updated=None):
|
||||
self.created = created
|
||||
self.human_id = human_id
|
||||
self.id = id or str(uuid.uuid4())
|
||||
self.id = id or uuidutils.generate_uuid()
|
||||
self.minDisk = minDisk
|
||||
self.minRam = minRam
|
||||
self.name = name
|
||||
|
@ -64,7 +64,7 @@ class FlavorDetails(object):
|
|||
name=None, ram=None, rxtx_factor=None, swap=None, vcpus=None):
|
||||
self.disk = disk or 10
|
||||
self.ephemeral = ephemeral or 10
|
||||
self.id = id or str(uuid.uuid4())
|
||||
self.id = id or uuidutils.generate_uuid()
|
||||
self.is_public = is_public or 'N/A'
|
||||
self.name = name
|
||||
self.ram = ram or 512
|
||||
|
@ -108,7 +108,7 @@ class VmStatusDetails(object):
|
|||
|
||||
class VmGroupDetails(object):
|
||||
def __init__(self, vm_group_id, name, policies=None):
|
||||
self.id = vm_group_id or str(uuid.uuid4())
|
||||
self.id = vm_group_id or uuidutils.generate_uuid()
|
||||
self.name = name or 'cue_group'
|
||||
self.policies = policies or ['anti-affinity']
|
||||
|
||||
|
@ -244,7 +244,7 @@ class NovaClient(base.BaseFixture):
|
|||
if missing:
|
||||
raise nova_exc.BadRequest(400)
|
||||
|
||||
newVm = VmDetails(vm_id=uuid.uuid4(), name=name,
|
||||
newVm = VmDetails(vm_id=uuidutils.generate_uuid(), name=name,
|
||||
flavor=flavor, image=image,
|
||||
port_list=port_list,
|
||||
status='BUILDING')
|
||||
|
@ -258,7 +258,7 @@ class NovaClient(base.BaseFixture):
|
|||
if group_id not in self._vm_group_list:
|
||||
raise nova_exc.BadRequest(400)
|
||||
|
||||
newVm.host_id = str(uuid.uuid4())
|
||||
newVm.host_id = uuidutils.generate_uuid()
|
||||
|
||||
self._vm_list[str(newVm.id)] = newVm
|
||||
|
||||
|
@ -404,8 +404,8 @@ class NovaClient(base.BaseFixture):
|
|||
:return: An updated copy of the 'body' that was passed in, with other
|
||||
information populated.
|
||||
"""
|
||||
newVmGroup = VmGroupDetails(vm_group_id=str(uuid.uuid4()), name=name,
|
||||
policies=policies)
|
||||
newVmGroup = VmGroupDetails(vm_group_id=uuidutils.generate_uuid(),
|
||||
name=name, policies=policies)
|
||||
|
||||
self._vm_group_list[newVmGroup.id] = newVmGroup
|
||||
return newVmGroup
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from cue.db.sqlalchemy import models
|
||||
from cue.monitor import monitor_service as cue_monitor_service
|
||||
|
@ -44,9 +44,9 @@ class MonitorFunctionalTests(base.FunctionalTestCase):
|
|||
CONF.set_override("zk_port", "", group="taskflow",
|
||||
enforce_type=True)
|
||||
|
||||
self.active_cluster_id = uuid.uuid4()
|
||||
self.error_cluster_id = uuid.uuid4()
|
||||
self.down_cluster_id = uuid.uuid4()
|
||||
self.active_cluster_id = uuidutils.generate_uuid()
|
||||
self.error_cluster_id = uuidutils.generate_uuid()
|
||||
self.down_cluster_id = uuidutils.generate_uuid()
|
||||
|
||||
# Add some test clusters
|
||||
set_up_test_clusters(
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
"""
|
||||
Tests for cue broker_metadata object.
|
||||
"""
|
||||
import uuid
|
||||
|
||||
from cue.common import exception
|
||||
from cue.db import api as db_api
|
||||
|
@ -26,6 +25,8 @@ from cue.tests.functional import base
|
|||
from cue.tests.functional import utils as func_utils
|
||||
from cue.tests import utils as test_utils
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
|
||||
class BrokerObjectsTests(base.FunctionalTestCase):
|
||||
dbapi = db_api.get_instance()
|
||||
|
@ -120,7 +121,7 @@ class BrokerObjectsTests(base.FunctionalTestCase):
|
|||
BrokerMetadata objects API.
|
||||
"""
|
||||
test_metadata_dict = func_utils.get_test_broker_metadata_dict(
|
||||
broker_id=str(uuid.uuid4()))
|
||||
broker_id=uuidutils.generate_uuid())
|
||||
new_broker_metadata = objects.BrokerMetadata(**test_metadata_dict)
|
||||
self.validate_broker_metadata_values(new_broker_metadata,
|
||||
test_metadata_dict)
|
||||
|
@ -212,4 +213,4 @@ class BrokerObjectsTests(base.FunctionalTestCase):
|
|||
metadata_returned = self.dbapi.get_broker_metadata_by_broker_id(
|
||||
self.context, new_broker_metadata.broker_id)
|
||||
|
||||
self.assertListEqual([], metadata_returned)
|
||||
self.assertListEqual([], metadata_returned)
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
"""
|
||||
Tests for cue cluster object.
|
||||
"""
|
||||
import uuid
|
||||
|
||||
import mock
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import testtools
|
||||
|
||||
from cue.api.controllers.v1 import cluster
|
||||
|
@ -163,7 +163,7 @@ class ClusterObjectsTests(base.FunctionalTestCase):
|
|||
cluster_list = list()
|
||||
for list_size in range(3):
|
||||
new_cluster = func_utils.create_object_cluster(
|
||||
self.context, id=str(uuid.uuid4()))
|
||||
self.context, id=uuidutils.generate_uuid())
|
||||
cluster_list.append(new_cluster)
|
||||
|
||||
returned_cluster_list = objects.Cluster.get_clusters(self.context)
|
||||
|
@ -228,4 +228,4 @@ class ClusterObjectsTests(base.FunctionalTestCase):
|
|||
return_value=api_cluster):
|
||||
with testtools.ExpectedException(exception.NotAuthorized):
|
||||
cluster.delete_complete_cluster(
|
||||
tenant_b, api_cluster.id)
|
||||
tenant_b, api_cluster.id)
|
||||
|
|
|
@ -13,9 +13,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
|
||||
from cue import client
|
||||
from cue.db import api as db_api
|
||||
from cue.db.sqlalchemy import models
|
||||
|
@ -27,6 +24,7 @@ from cue.tests.functional.fixtures import neutron
|
|||
from cue.tests.functional.fixtures import nova
|
||||
from cue.tests.functional.fixtures import urllib2_fixture
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
from taskflow import engines
|
||||
|
||||
|
||||
|
@ -50,7 +48,7 @@ class CheckClusterStatusTests(base.FunctionalTestCase):
|
|||
self.neutron_client = client.neutron_client()
|
||||
self.port = '5672'
|
||||
|
||||
self.new_vm_name = str(uuid.uuid4())
|
||||
self.new_vm_name = uuidutils.generate_uuid()
|
||||
self.new_vm_list = []
|
||||
|
||||
image_list = self.nova_client.images.list()
|
||||
|
@ -86,9 +84,9 @@ class CheckClusterStatusTests(base.FunctionalTestCase):
|
|||
"flavor": self.valid_flavor.id,
|
||||
"port": self.port,
|
||||
"context": self.context.to_dict(),
|
||||
"erlang_cookie": str(uuid.uuid4()),
|
||||
"erlang_cookie": uuidutils.generate_uuid(),
|
||||
"default_rabbit_user": 'rabbit',
|
||||
"default_rabbit_pass": str(uuid.uuid4()),
|
||||
"default_rabbit_pass": uuidutils.generate_uuid(),
|
||||
}
|
||||
flow_store_check = {
|
||||
"context": self.context.to_dict(),
|
||||
|
@ -99,7 +97,7 @@ class CheckClusterStatusTests(base.FunctionalTestCase):
|
|||
cluster_values = {
|
||||
"project_id": self.context.tenant_id,
|
||||
"name": "RabbitCluster",
|
||||
"network_id": str(uuid.uuid4()),
|
||||
"network_id": uuidutils.generate_uuid(),
|
||||
"flavor": "1",
|
||||
"size": 2,
|
||||
}
|
||||
|
@ -153,9 +151,9 @@ class CheckClusterStatusTests(base.FunctionalTestCase):
|
|||
"flavor": self.valid_flavor.id,
|
||||
"port": self.port,
|
||||
"context": self.context.to_dict(),
|
||||
"erlang_cookie": str(uuid.uuid4()),
|
||||
"erlang_cookie": uuidutils.generate_uuid(),
|
||||
"default_rabbit_user": 'rabbit',
|
||||
"default_rabbit_pass": str(uuid.uuid4()),
|
||||
"default_rabbit_pass": uuidutils.generate_uuid(),
|
||||
}
|
||||
flow_store_check = {
|
||||
"context": self.context.to_dict(),
|
||||
|
@ -166,7 +164,7 @@ class CheckClusterStatusTests(base.FunctionalTestCase):
|
|||
cluster_values = {
|
||||
"project_id": self.context.tenant_id,
|
||||
"name": "RabbitCluster",
|
||||
"network_id": str(uuid.uuid4()),
|
||||
"network_id": uuidutils.generate_uuid(),
|
||||
"flavor": "1",
|
||||
"size": 2,
|
||||
}
|
||||
|
@ -222,9 +220,9 @@ class CheckClusterStatusTests(base.FunctionalTestCase):
|
|||
"flavor": self.valid_flavor.id,
|
||||
"port": self.port,
|
||||
"context": self.context.to_dict(),
|
||||
"erlang_cookie": str(uuid.uuid4()),
|
||||
"erlang_cookie": uuidutils.generate_uuid(),
|
||||
"default_rabbit_user": 'rabbit',
|
||||
"default_rabbit_pass": str(uuid.uuid4()),
|
||||
"default_rabbit_pass": uuidutils.generate_uuid(),
|
||||
}
|
||||
flow_store_check = {
|
||||
"context": self.context.to_dict(),
|
||||
|
@ -235,7 +233,7 @@ class CheckClusterStatusTests(base.FunctionalTestCase):
|
|||
cluster_values = {
|
||||
"project_id": self.context.tenant_id,
|
||||
"name": "RabbitCluster",
|
||||
"network_id": str(uuid.uuid4()),
|
||||
"network_id": uuidutils.generate_uuid(),
|
||||
"flavor": "1",
|
||||
"size": 1,
|
||||
}
|
||||
|
@ -284,4 +282,4 @@ class CheckClusterStatusTests(base.FunctionalTestCase):
|
|||
def tearDown(self):
|
||||
for vm_id in self.new_vm_list:
|
||||
self.nova_client.servers.delete(vm_id)
|
||||
super(CheckClusterStatusTests, self).tearDown()
|
||||
super(CheckClusterStatusTests, self).tearDown()
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
from neutronclient.common import exceptions as neutron_exceptions
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import uuidutils
|
||||
from taskflow import engines
|
||||
import taskflow.exceptions as taskflow_exc
|
||||
|
||||
|
@ -53,7 +53,7 @@ class CreateClusterTests(base.FunctionalTestCase):
|
|||
self.neutron_client = client.neutron_client()
|
||||
self.port = u'5672'
|
||||
|
||||
self.new_vm_name = str(uuid.uuid4())
|
||||
self.new_vm_name = uuidutils.generate_uuid()
|
||||
self.new_vm_list = []
|
||||
|
||||
image_list = self.nova_client.images.list()
|
||||
|
@ -92,9 +92,9 @@ class CreateClusterTests(base.FunctionalTestCase):
|
|||
"flavor": self.valid_flavor.id,
|
||||
"port": self.port,
|
||||
"context": self.context.to_dict(),
|
||||
"erlang_cookie": str(uuid.uuid4()),
|
||||
"erlang_cookie": uuidutils.generate_uuid(),
|
||||
"default_rabbit_user": 'rabbit',
|
||||
"default_rabbit_pass": str(uuid.uuid4()),
|
||||
"default_rabbit_pass": uuidutils.generate_uuid(),
|
||||
}
|
||||
|
||||
cluster_values = {
|
||||
|
@ -162,9 +162,9 @@ class CreateClusterTests(base.FunctionalTestCase):
|
|||
"flavor": self.valid_flavor.id,
|
||||
"port": self.port,
|
||||
"context": self.context.to_dict(),
|
||||
"erlang_cookie": str(uuid.uuid4()),
|
||||
"erlang_cookie": uuidutils.generate_uuid(),
|
||||
"default_rabbit_user": 'rabbit',
|
||||
"default_rabbit_pass": str(uuid.uuid4()),
|
||||
"default_rabbit_pass": uuidutils.generate_uuid(),
|
||||
}
|
||||
|
||||
cluster_values = {
|
||||
|
@ -219,9 +219,9 @@ class CreateClusterTests(base.FunctionalTestCase):
|
|||
"flavor": self.valid_flavor.id,
|
||||
"port": self.port,
|
||||
"context": self.context.to_dict(),
|
||||
"erlang_cookie": str(uuid.uuid4()),
|
||||
"erlang_cookie": uuidutils.generate_uuid(),
|
||||
"default_rabbit_user": 'rabbit',
|
||||
"default_rabbit_pass": str(uuid.uuid4()),
|
||||
"default_rabbit_pass": uuidutils.generate_uuid(),
|
||||
}
|
||||
|
||||
cluster_values = {
|
||||
|
@ -278,9 +278,9 @@ class CreateClusterTests(base.FunctionalTestCase):
|
|||
"flavor": self.valid_flavor.id,
|
||||
"port": self.port,
|
||||
"context": self.context.to_dict(),
|
||||
"erlang_cookie": str(uuid.uuid4()),
|
||||
"erlang_cookie": uuidutils.generate_uuid(),
|
||||
"default_rabbit_user": 'rabbit',
|
||||
"default_rabbit_pass": str(uuid.uuid4()),
|
||||
"default_rabbit_pass": uuidutils.generate_uuid(),
|
||||
}
|
||||
|
||||
cluster_values = {
|
||||
|
@ -334,9 +334,9 @@ class CreateClusterTests(base.FunctionalTestCase):
|
|||
'flavor': self.valid_flavor.id,
|
||||
"port": self.port,
|
||||
"context": self.context.to_dict(),
|
||||
"erlang_cookie": str(uuid.uuid4()),
|
||||
"erlang_cookie": uuidutils.generate_uuid(),
|
||||
"default_rabbit_user": 'rabbit',
|
||||
"default_rabbit_pass": str(uuid.uuid4()),
|
||||
"default_rabbit_pass": uuidutils.generate_uuid(),
|
||||
}
|
||||
|
||||
cluster_values = {
|
||||
|
@ -369,7 +369,7 @@ class CreateClusterTests(base.FunctionalTestCase):
|
|||
self.assertEqual(port_list, self.neutron_client.list_ports())
|
||||
|
||||
def test_create_cluster_invalid_user_network(self):
|
||||
invalid_network_id = str(uuid.uuid4())
|
||||
invalid_network_id = uuidutils.generate_uuid()
|
||||
cluster_size = 3
|
||||
|
||||
flow_store = {
|
||||
|
@ -378,9 +378,9 @@ class CreateClusterTests(base.FunctionalTestCase):
|
|||
'flavor': self.valid_flavor.id,
|
||||
"port": self.port,
|
||||
"context": self.context.to_dict(),
|
||||
"erlang_cookie": str(uuid.uuid4()),
|
||||
"erlang_cookie": uuidutils.generate_uuid(),
|
||||
"default_rabbit_user": 'rabbit',
|
||||
"default_rabbit_pass": str(uuid.uuid4()),
|
||||
"default_rabbit_pass": uuidutils.generate_uuid(),
|
||||
}
|
||||
|
||||
cluster_values = {
|
||||
|
@ -426,15 +426,15 @@ class CreateClusterTests(base.FunctionalTestCase):
|
|||
'flavor': self.valid_flavor.id,
|
||||
"port": self.port,
|
||||
"context": self.context.to_dict(),
|
||||
"erlang_cookie": str(uuid.uuid4()),
|
||||
"erlang_cookie": uuidutils.generate_uuid(),
|
||||
"default_rabbit_user": 'rabbit',
|
||||
"default_rabbit_pass": str(uuid.uuid4()),
|
||||
"default_rabbit_pass": uuidutils.generate_uuid(),
|
||||
}
|
||||
|
||||
cluster_values = {
|
||||
"project_id": self.context.tenant_id,
|
||||
"name": "RabbitCluster",
|
||||
"network_id": str(uuid.uuid4()),
|
||||
"network_id": uuidutils.generate_uuid(),
|
||||
"flavor": "1",
|
||||
"size": 3,
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
from cue import client
|
||||
from cue.common import exception
|
||||
|
@ -27,6 +26,7 @@ from cue.tests.functional.fixtures import nova
|
|||
from cue.tests.functional.fixtures import urllib2_fixture
|
||||
|
||||
import novaclient.exceptions as nova_exc
|
||||
from oslo_utils import uuidutils
|
||||
from taskflow import engines
|
||||
import taskflow.exceptions as taskflow_exc
|
||||
|
||||
|
@ -50,7 +50,7 @@ class DeleteClusterTests(base.FunctionalTestCase):
|
|||
self.neutron_client = client.neutron_client()
|
||||
self.port = '5672'
|
||||
|
||||
self.new_vm_name = str(uuid.uuid4())
|
||||
self.new_vm_name = uuidutils.generate_uuid()
|
||||
self.new_vm_list = []
|
||||
|
||||
image_list = self.nova_client.images.list()
|
||||
|
@ -89,9 +89,9 @@ class DeleteClusterTests(base.FunctionalTestCase):
|
|||
"flavor": self.valid_flavor.id,
|
||||
"port": self.port,
|
||||
"context": self.context.to_dict(),
|
||||
"erlang_cookie": str(uuid.uuid4()),
|
||||
"erlang_cookie": uuidutils.generate_uuid(),
|
||||
"default_rabbit_user": 'rabbit',
|
||||
"default_rabbit_pass": str(uuid.uuid4()),
|
||||
"default_rabbit_pass": uuidutils.generate_uuid()
|
||||
}
|
||||
flow_store_delete = {
|
||||
"context": self.context.to_dict(),
|
||||
|
@ -100,7 +100,7 @@ class DeleteClusterTests(base.FunctionalTestCase):
|
|||
cluster_values = {
|
||||
"project_id": self.context.tenant_id,
|
||||
"name": "RabbitCluster",
|
||||
"network_id": str(uuid.uuid4()),
|
||||
"network_id": uuidutils.generate_uuid(),
|
||||
"flavor": "1",
|
||||
"size": 3,
|
||||
}
|
||||
|
@ -178,9 +178,9 @@ class DeleteClusterTests(base.FunctionalTestCase):
|
|||
"flavor": self.valid_flavor.id,
|
||||
"port": self.port,
|
||||
"context": self.context.to_dict(),
|
||||
"erlang_cookie": str(uuid.uuid4()),
|
||||
"erlang_cookie": uuidutils.generate_uuid(),
|
||||
"default_rabbit_user": 'rabbit',
|
||||
"default_rabbit_pass": str(uuid.uuid4()),
|
||||
"default_rabbit_pass": uuidutils.generate_uuid(),
|
||||
}
|
||||
flow_store_delete = {
|
||||
"context": self.context.to_dict(),
|
||||
|
@ -189,7 +189,7 @@ class DeleteClusterTests(base.FunctionalTestCase):
|
|||
cluster_values = {
|
||||
"project_id": self.context.tenant_id,
|
||||
"name": "RabbitCluster",
|
||||
"network_id": str(uuid.uuid4()),
|
||||
"network_id": uuidutils.generate_uuid(),
|
||||
"flavor": "1",
|
||||
"size": 3,
|
||||
}
|
||||
|
@ -240,11 +240,11 @@ class DeleteClusterTests(base.FunctionalTestCase):
|
|||
}
|
||||
|
||||
cluster_size = 3
|
||||
cluster_id = str(uuid.uuid4())
|
||||
server_group_id = str(uuid.uuid4())
|
||||
cluster_id = uuidutils.generate_uuid()
|
||||
server_group_id = uuidutils.generate_uuid()
|
||||
node_ids = []
|
||||
for i in range(0, cluster_size):
|
||||
node_ids.append(str(uuid.uuid4()))
|
||||
node_ids.append(uuidutils.generate_uuid())
|
||||
|
||||
flow_delete = delete_cluster(cluster_id, node_ids, server_group_id)
|
||||
|
||||
|
@ -257,4 +257,4 @@ class DeleteClusterTests(base.FunctionalTestCase):
|
|||
def tearDown(self):
|
||||
for vm_id in self.new_vm_list:
|
||||
self.nova_client.servers.delete(vm_id)
|
||||
super(DeleteClusterTests, self).tearDown()
|
||||
super(DeleteClusterTests, self).tearDown()
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
from cue import client
|
||||
from cue.tests.functional import base
|
||||
|
@ -21,6 +20,7 @@ import cue.tests.functional.fixtures.neutron
|
|||
import os_tasklib.neutron as neutron_task
|
||||
|
||||
from neutronclient.common import exceptions
|
||||
from oslo_utils import uuidutils
|
||||
from taskflow import engines
|
||||
from taskflow.patterns import linear_flow
|
||||
|
||||
|
@ -49,7 +49,7 @@ class CreatePortTests(base.FunctionalTestCase):
|
|||
os_client=neutron_client, provides='neutron_port_id'))
|
||||
|
||||
# generate a new UUID for an 'invalid' network_id
|
||||
CreatePortTests.task_store['network_id'] = str(uuid.uuid4())
|
||||
CreatePortTests.task_store['network_id'] = uuidutils.generate_uuid()
|
||||
|
||||
self.assertRaises(exceptions.NetworkNotFoundClient, engines.run, flow,
|
||||
store=CreatePortTests.task_store)
|
||||
|
@ -63,7 +63,8 @@ class CreatePortTests(base.FunctionalTestCase):
|
|||
networks = neutron_client.list_networks(name=network_name)
|
||||
network = networks['networks'][0]
|
||||
CreatePortTests.task_store['network_id'] = network['id']
|
||||
CreatePortTests.task_store['port_name'] = "port_" + str(uuid.uuid4())
|
||||
CreatePortTests.task_store['port_name'] = "port_" + (
|
||||
uuidutils.generate_uuid())
|
||||
|
||||
# create flow with "CreatePort" task, given neutron client
|
||||
flow = linear_flow.Flow('create port').add(neutron_task.CreatePort(
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
from cue import client
|
||||
from cue.tests.functional import base
|
||||
|
@ -22,6 +21,7 @@ from cue.tests.functional.fixtures import nova
|
|||
import os_tasklib.nova.create_vm as create_vm
|
||||
|
||||
import novaclient.exceptions as nova_exc
|
||||
from oslo_utils import uuidutils
|
||||
from taskflow import engines
|
||||
import taskflow.exceptions as taskflow_exc
|
||||
from taskflow.patterns import linear_flow
|
||||
|
@ -42,7 +42,7 @@ class CreateVmTests(base.FunctionalTestCase):
|
|||
self.nova_client = client.nova_client()
|
||||
self.neutron_client = client.neutron_client()
|
||||
|
||||
self.new_vm_name = str(uuid.uuid4())
|
||||
self.new_vm_name = uuidutils.generate_uuid()
|
||||
self.new_vm_id = None
|
||||
|
||||
image_list = self.nova_client.images.list()
|
||||
|
@ -83,7 +83,7 @@ class CreateVmTests(base.FunctionalTestCase):
|
|||
self.assertEqual(self.new_vm_name, new_vm.name)
|
||||
|
||||
def test_create_vm_invalid_flavor(self):
|
||||
invalid_flavor = str(uuid.uuid4())
|
||||
invalid_flavor = uuidutils.generate_uuid()
|
||||
flow_store = {
|
||||
'vm_name': self.new_vm_name,
|
||||
'image': self.valid_image,
|
||||
|
@ -97,7 +97,7 @@ class CreateVmTests(base.FunctionalTestCase):
|
|||
self.flow, store=flow_store)
|
||||
|
||||
def test_create_vm_invalid_image(self):
|
||||
invalid_image = str(uuid.uuid4())
|
||||
invalid_image = uuidutils.generate_uuid()
|
||||
flow_store = {
|
||||
'vm_name': self.new_vm_name,
|
||||
'image': invalid_image,
|
||||
|
@ -111,7 +111,7 @@ class CreateVmTests(base.FunctionalTestCase):
|
|||
self.flow, store=flow_store)
|
||||
|
||||
def test_create_vm_invalid_nic(self):
|
||||
invalid_nic = str(uuid.uuid4())
|
||||
invalid_nic = uuidutils.generate_uuid()
|
||||
flow_store = {
|
||||
'vm_name': self.new_vm_name,
|
||||
'image': self.valid_image,
|
||||
|
@ -132,7 +132,7 @@ class CreateVmTests(base.FunctionalTestCase):
|
|||
engines.run, self.flow, store=flow_store)
|
||||
|
||||
def test_invalid_security_group(self):
|
||||
invalid_security_group = str(uuid.uuid4())
|
||||
invalid_security_group = uuidutils.generate_uuid()
|
||||
flow_store = {
|
||||
'vm_name': self.new_vm_name,
|
||||
'image': self.valid_image.id,
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
from cue import client
|
||||
from cue.tests.functional import base
|
||||
from cue.tests.functional.fixtures import nova
|
||||
import os_tasklib.nova.create_vm_group as create_vm_group
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
from taskflow import engines
|
||||
from taskflow.patterns import linear_flow
|
||||
|
||||
|
@ -34,7 +34,7 @@ class CreateVmGroupTests(base.FunctionalTestCase):
|
|||
|
||||
self.nova_client = client.nova_client()
|
||||
|
||||
self.new_vm_group_name = str(uuid.uuid4())
|
||||
self.new_vm_group_name = uuidutils.generate_uuid()
|
||||
self.new_vm_group_id = None
|
||||
|
||||
self.flow = linear_flow.Flow("create vm group flow")
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
from cue import client
|
||||
from cue.tests.functional import base
|
||||
|
@ -21,6 +20,7 @@ import cue.tests.functional.fixtures.neutron
|
|||
import os_tasklib.neutron as neutron_task
|
||||
|
||||
import neutronclient.common.exceptions as neutron_exc
|
||||
from oslo_utils import uuidutils
|
||||
from taskflow import engines
|
||||
from taskflow.patterns import linear_flow
|
||||
|
||||
|
@ -129,7 +129,7 @@ class DeletePortTests(base.FunctionalTestCase):
|
|||
|
||||
def test_delete_nonexistent_port(self):
|
||||
# generate random port_id
|
||||
port_id = uuid.uuid4().hex
|
||||
port_id = uuidutils.generate_uuid(dashed=False)
|
||||
|
||||
task_store = {
|
||||
'port_ids': port_id
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
from cue import client
|
||||
from cue.tests.functional import base
|
||||
from cue.tests.functional.fixtures import nova
|
||||
import os_tasklib.nova.delete_vm as delete_vm
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
from taskflow import engines
|
||||
from taskflow.patterns import linear_flow
|
||||
|
||||
|
@ -64,7 +64,7 @@ class DeleteVmTests(base.FunctionalTestCase):
|
|||
flavor=self.flavor)]
|
||||
|
||||
# delete non-existing vm (invalid id)
|
||||
DeleteVmTests.task_store['server'] = str(uuid.uuid4())
|
||||
DeleteVmTests.task_store['server'] = uuidutils.generate_uuid()
|
||||
|
||||
# start engine to run delete task
|
||||
engines.run(self.flow, store=DeleteVmTests.task_store)
|
||||
|
@ -114,4 +114,4 @@ class DeleteVmTests(base.FunctionalTestCase):
|
|||
for vm in new_instances:
|
||||
self.nova_client.servers.delete(vm)
|
||||
|
||||
self.assertFalse(vm_found, "VM was not deleted successfully")
|
||||
self.assertFalse(vm_found, "VM was not deleted successfully")
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
from cue import client
|
||||
from cue.tests.functional import base
|
||||
|
@ -21,6 +20,7 @@ from cue.tests.functional.fixtures import nova
|
|||
import os_tasklib.nova.delete_vm_group as delete_vm_group
|
||||
|
||||
import novaclient.exceptions as nova_exc
|
||||
from oslo_utils import uuidutils
|
||||
from taskflow import engines
|
||||
from taskflow.patterns import linear_flow
|
||||
|
||||
|
@ -39,7 +39,7 @@ class DeleteVmGroupTests(base.FunctionalTestCase):
|
|||
|
||||
self.nova_client = client.nova_client()
|
||||
|
||||
self.new_vm_group_name = str(uuid.uuid4())
|
||||
self.new_vm_group_name = uuidutils.generate_uuid()
|
||||
self.new_vm_group_id = None
|
||||
|
||||
self.flow = linear_flow.Flow("delete vm group flow")
|
||||
|
@ -58,7 +58,7 @@ class DeleteVmGroupTests(base.FunctionalTestCase):
|
|||
self.nova_client.server_groups.create(name="server_group_3",
|
||||
policies=['anti-affinity'])]
|
||||
|
||||
self.task_store['group'] = str(uuid.uuid4())
|
||||
self.task_store['group'] = uuidutils.generate_uuid()
|
||||
|
||||
# start engine to run delete task
|
||||
engines.run(self.flow, store=DeleteVmGroupTests.task_store)
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
from cue import client
|
||||
from cue.tests.functional import base
|
||||
|
@ -21,6 +20,7 @@ from cue.tests.functional.fixtures import nova
|
|||
import os_tasklib.nova.get_vm as get_vm
|
||||
|
||||
import novaclient.exceptions as nova_exc
|
||||
from oslo_utils import uuidutils
|
||||
from taskflow import engines
|
||||
from taskflow.patterns import linear_flow
|
||||
|
||||
|
@ -37,7 +37,7 @@ class GetVmTests(base.FunctionalTestCase):
|
|||
|
||||
self.nova_client = client.nova_client()
|
||||
|
||||
self.valid_vm_name = str(uuid.uuid4())
|
||||
self.valid_vm_name = uuidutils.generate_uuid()
|
||||
|
||||
image_list = self.nova_client.images.list()
|
||||
for image in image_list:
|
||||
|
@ -72,7 +72,7 @@ class GetVmTests(base.FunctionalTestCase):
|
|||
self.assertEqual(self.valid_vm_name, new_vm['name'])
|
||||
|
||||
def test_get_invalid_vm(self):
|
||||
invalid_vm_id = str(uuid.uuid4())
|
||||
invalid_vm_id = uuidutils.generate_uuid()
|
||||
flow_store = {
|
||||
'server': invalid_vm_id
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
from cue import client
|
||||
from cue.tests.functional import base
|
||||
|
@ -22,6 +21,7 @@ from cue.tests.functional.fixtures import nova
|
|||
import os_tasklib.nova.list_vm_interfaces as list_vm_interfaces
|
||||
|
||||
import novaclient.exceptions as nova_exc
|
||||
from oslo_utils import uuidutils
|
||||
from taskflow import engines
|
||||
from taskflow.patterns import linear_flow
|
||||
|
||||
|
@ -40,7 +40,7 @@ class GetVmInterfacesTests(base.FunctionalTestCase):
|
|||
self.nova_client = client.nova_client()
|
||||
self.neutron_client = client.neutron_client()
|
||||
|
||||
self.valid_vm_name = str(uuid.uuid4())
|
||||
self.valid_vm_name = uuidutils.generate_uuid()
|
||||
|
||||
image_list = self.nova_client.images.list()
|
||||
for image in image_list:
|
||||
|
@ -83,7 +83,7 @@ class GetVmInterfacesTests(base.FunctionalTestCase):
|
|||
|
||||
def test_get_vm_interfaces_invalid_vm(self):
|
||||
flow_store = {
|
||||
'server': str(uuid.uuid4())
|
||||
'server': uuidutils.generate_uuid()
|
||||
}
|
||||
|
||||
self.assertRaises(nova_exc.NotFound, engines.run, self.flow,
|
||||
|
@ -91,7 +91,7 @@ class GetVmInterfacesTests(base.FunctionalTestCase):
|
|||
|
||||
def test_get_vm_interfaces_invalid_vm_ignore_not_found_exception(self):
|
||||
flow_store = {
|
||||
'server': str(uuid.uuid4()),
|
||||
'server': uuidutils.generate_uuid(),
|
||||
'ignore_nova_not_found_exception': True
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
from cue import client
|
||||
from cue.db.sqlalchemy import models
|
||||
|
@ -24,6 +23,7 @@ from cue.tests.functional.fixtures import neutron
|
|||
import os_tasklib.neutron as neutron_task
|
||||
|
||||
from neutronclient.common import exceptions
|
||||
from oslo_utils import uuidutils
|
||||
from taskflow import engines
|
||||
from taskflow.patterns import linear_flow
|
||||
|
||||
|
@ -37,7 +37,7 @@ class UpdateClusterRecordTest(base.FunctionalTestCase):
|
|||
task_store = {
|
||||
"context": "context",
|
||||
"cluster_id": "id",
|
||||
"network_id": str(uuid.uuid4()),
|
||||
"network_id": uuidutils.generate_uuid(),
|
||||
"port_name": "port_0",
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ class UpdateClusterRecordTest(base.FunctionalTestCase):
|
|||
cluster_values = {
|
||||
"project_id": self.context.tenant_id,
|
||||
"name": "RabbitCluster",
|
||||
"network_id": str(uuid.uuid4()),
|
||||
"network_id": uuidutils.generate_uuid(),
|
||||
"flavor": "1",
|
||||
"size": 3,
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ class UpdateClusterRecordTest(base.FunctionalTestCase):
|
|||
cluster_values = {
|
||||
"project_id": self.context.tenant_id,
|
||||
"name": "RabbitCluster",
|
||||
"network_id": str(uuid.uuid4()),
|
||||
"network_id": uuidutils.generate_uuid(),
|
||||
"flavor": "1",
|
||||
"size": 3,
|
||||
}
|
||||
|
@ -131,4 +131,4 @@ class UpdateClusterRecordTest(base.FunctionalTestCase):
|
|||
cluster_after = objects.Cluster.get_cluster_by_id(self.context,
|
||||
new_cluster.id)
|
||||
self.assertEqual(models.Status.ERROR, cluster_after.status,
|
||||
"Invalid status")
|
||||
"Invalid status")
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import uuid
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
import taskflow.patterns.linear_flow as linear_flow
|
||||
|
@ -91,7 +90,8 @@ class ApiTaskFlowClientTest(api.APITest):
|
|||
def test_create_cluster_api(self):
|
||||
"""This test verifies create cluster job is posted from REST API."""
|
||||
api_cluster = test_utils.create_api_test_cluster(size=1,
|
||||
network_id=[str(uuid.uuid4())])
|
||||
network_id=(
|
||||
[uuidutils.generate_uuid()]))
|
||||
pre_count = self.tf_client.jobboard.job_count
|
||||
self.post_json('/clusters', params=api_cluster,
|
||||
headers=self.auth_headers, status=202)
|
||||
|
@ -113,4 +113,4 @@ class ApiTaskFlowClientTest(api.APITest):
|
|||
|
||||
self.assertEqual(expected, post_count,
|
||||
"expected %d jobs in the jobboard after a post, "
|
||||
"got %d" % (expected, post_count))
|
||||
"got %d" % (expected, post_count))
|
||||
|
|
|
@ -13,31 +13,31 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
from cue.common import context
|
||||
from cue.tests.unit import base
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
|
||||
class TestContext(base.UnitTestCase):
|
||||
|
||||
def test_context(self):
|
||||
original_context = {
|
||||
'auth_token': str(uuid.uuid4()),
|
||||
'user': str(uuid.uuid4()),
|
||||
'tenant': str(uuid.uuid4()),
|
||||
'domain': str(uuid.uuid4()),
|
||||
'user_domain': str(uuid.uuid4()),
|
||||
'project_domain': str(uuid.uuid4()),
|
||||
'auth_token': uuidutils.generate_uuid(),
|
||||
'user': uuidutils.generate_uuid(),
|
||||
'tenant': uuidutils.generate_uuid(),
|
||||
'domain': uuidutils.generate_uuid(),
|
||||
'user_domain': uuidutils.generate_uuid(),
|
||||
'project_domain': uuidutils.generate_uuid(),
|
||||
'is_admin': False,
|
||||
'read_only': False,
|
||||
'show_deleted': False,
|
||||
'request_id': str(uuid.uuid4()),
|
||||
'resource_uuid': str(uuid.uuid4()),
|
||||
'roles': str(uuid.uuid4()),
|
||||
'request_id': uuidutils.generate_uuid(),
|
||||
'resource_uuid': uuidutils.generate_uuid(),
|
||||
'roles': uuidutils.generate_uuid(),
|
||||
'is_public_api': False,
|
||||
'domain_id': str(uuid.uuid4()),
|
||||
'domain_name': str(uuid.uuid4())
|
||||
'domain_id': uuidutils.generate_uuid(),
|
||||
'domain_name': uuidutils.generate_uuid()
|
||||
}
|
||||
|
||||
req_context = context.RequestContext(**original_context)
|
||||
|
@ -51,13 +51,13 @@ class TestContext(base.UnitTestCase):
|
|||
self.assertDictEqual(original_context, context_dict)
|
||||
|
||||
def test_tenant_id(self):
|
||||
tenant_id = str(uuid.uuid4())
|
||||
tenant_id = uuidutils.generate_uuid()
|
||||
req_context = context.RequestContext()
|
||||
req_context.tenant_id = tenant_id
|
||||
self.assertEqual(tenant_id, req_context.tenant_id)
|
||||
|
||||
def test_user_id(self):
|
||||
user_id = str(uuid.uuid4())
|
||||
user_id = uuidutils.generate_uuid()
|
||||
req_context = context.RequestContext()
|
||||
req_context.user_id = user_id
|
||||
self.assertEqual(user_id, req_context.user_id)
|
||||
|
|
|
@ -21,8 +21,8 @@ import logging
|
|||
import sys
|
||||
import time
|
||||
import traceback
|
||||
import uuid
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
import paramiko
|
||||
import tempest_lib.base
|
||||
from tempest_lib.common.utils import data_utils
|
||||
|
@ -254,7 +254,7 @@ class ClusterTest(tempest_lib.base.BaseTestCase):
|
|||
'size': 1,
|
||||
'flavor': '8795',
|
||||
'volume_size': 100,
|
||||
'network_id': [str(uuid.uuid4())],
|
||||
'network_id': [uuidutils.generate_uuid()],
|
||||
'authentication': {'type': 'PLAIN',
|
||||
'token': {'username': 'rabbitmq',
|
||||
'password': 'rabbit'}}
|
||||
|
@ -270,7 +270,7 @@ class ClusterTest(tempest_lib.base.BaseTestCase):
|
|||
'name': 'fake name',
|
||||
'flavor': '8795',
|
||||
'volume_size': 100,
|
||||
'network_id': [str(uuid.uuid4())],
|
||||
'network_id': [uuidutils.generate_uuid()],
|
||||
'authentication': {'type': 'PLAIN',
|
||||
'token': {'username': 'rabbitmq',
|
||||
'password': 'rabbit'}}
|
||||
|
@ -286,7 +286,7 @@ class ClusterTest(tempest_lib.base.BaseTestCase):
|
|||
'name': 'fake name',
|
||||
'size': 1,
|
||||
'volume_size': 100,
|
||||
'network_id': [str(uuid.uuid4())],
|
||||
'network_id': [uuidutils.generate_uuid()],
|
||||
'authentication': {'type': 'PLAIN',
|
||||
'token': {'username': 'rabbitmq',
|
||||
'password': 'rabbit'}}
|
||||
|
@ -342,7 +342,7 @@ class ClusterTest(tempest_lib.base.BaseTestCase):
|
|||
'size': 0,
|
||||
'flavor': '8795',
|
||||
'volume_size': 100,
|
||||
'network_id': [str(uuid.uuid4())],
|
||||
'network_id': [uuidutils.generate_uuid()],
|
||||
'authentication': {'type': 'PLAIN',
|
||||
'token': {'username': 'rabbitmq',
|
||||
'password': 'rabbit'}}
|
||||
|
@ -372,7 +372,7 @@ class ClusterTest(tempest_lib.base.BaseTestCase):
|
|||
'size': 1,
|
||||
'flavor': 0,
|
||||
'volume_size': 100,
|
||||
'network_id': [str(uuid.uuid4())],
|
||||
'network_id': [uuidutils.generate_uuid()],
|
||||
'authentication': {'type': 'PLAIN',
|
||||
'token': {'username': 'rabbitmq',
|
||||
'password': 'rabbit'}}
|
||||
|
@ -403,7 +403,7 @@ class ClusterTest(tempest_lib.base.BaseTestCase):
|
|||
'flavor': '8795',
|
||||
'size': 1,
|
||||
'volume_size': 100,
|
||||
'network_id': [str(uuid.uuid4())]
|
||||
'network_id': [uuidutils.generate_uuid()]
|
||||
}
|
||||
self.assertRaises(tempest_exceptions.BadRequest,
|
||||
self.client.create_cluster_from_body,
|
||||
|
@ -417,7 +417,7 @@ class ClusterTest(tempest_lib.base.BaseTestCase):
|
|||
'flavor': '8795',
|
||||
'size': 1,
|
||||
'volume_size': 100,
|
||||
'network_id': [str(uuid.uuid4())],
|
||||
'network_id': [uuidutils.generate_uuid()],
|
||||
'authentication': {'token': {'username': 'rabbitmq',
|
||||
'password': 'rabbit'}}
|
||||
}
|
||||
|
@ -433,7 +433,7 @@ class ClusterTest(tempest_lib.base.BaseTestCase):
|
|||
'flavor': '8795',
|
||||
'size': 1,
|
||||
'volume_size': 100,
|
||||
'network_id': [str(uuid.uuid4())],
|
||||
'network_id': [uuidutils.generate_uuid()],
|
||||
'authentication': {'type': 'PLAIN'}
|
||||
}
|
||||
self.assertRaises(tempest_exceptions.BadRequest,
|
||||
|
@ -448,7 +448,7 @@ class ClusterTest(tempest_lib.base.BaseTestCase):
|
|||
'flavor': '8795',
|
||||
'size': 1,
|
||||
'volume_size': 100,
|
||||
'network_id': [str(uuid.uuid4())],
|
||||
'network_id': [uuidutils.generate_uuid()],
|
||||
'authentication': {'type': 'PLAIN',
|
||||
'token': {'password': 'rabbit'}}
|
||||
}
|
||||
|
@ -464,7 +464,7 @@ class ClusterTest(tempest_lib.base.BaseTestCase):
|
|||
'flavor': '8795',
|
||||
'size': 1,
|
||||
'volume_size': 100,
|
||||
'network_id': [str(uuid.uuid4())],
|
||||
'network_id': [uuidutils.generate_uuid()],
|
||||
'authentication': {'type': 'PLAIN',
|
||||
'token': {'username': 'rabbitmq'}}
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ class ClusterTest(tempest_lib.base.BaseTestCase):
|
|||
'flavor': '8795',
|
||||
'size': 1,
|
||||
'volume_size': 100,
|
||||
'network_id': [str(uuid.uuid4())],
|
||||
'network_id': [uuidutils.generate_uuid()],
|
||||
'authentication': {'type': 'PLAIN',
|
||||
'token': {'username': '',
|
||||
'password': 'rabbit'}}
|
||||
|
@ -497,7 +497,7 @@ class ClusterTest(tempest_lib.base.BaseTestCase):
|
|||
'flavor': '8795',
|
||||
'size': 1,
|
||||
'volume_size': 100,
|
||||
'network_id': [str(uuid.uuid4())],
|
||||
'network_id': [uuidutils.generate_uuid()],
|
||||
'authentication': {'type': 'PLAIN',
|
||||
'token': {'username': 'rabbitmq',
|
||||
'password': ''}}
|
||||
|
|
Loading…
Reference in New Issue