Merge "Add method for better random name"
This commit is contained in:
commit
fa0c063d53
@ -12,9 +12,11 @@
|
||||
|
||||
import os
|
||||
import time
|
||||
import uuid
|
||||
|
||||
import fixtures
|
||||
import os_client_config
|
||||
import six
|
||||
import tempest_lib.cli.base
|
||||
import testtools
|
||||
|
||||
@ -190,3 +192,11 @@ class ClientTestBase(testtools.TestCase):
|
||||
else:
|
||||
self.fail("Volume %s did not reach status %s after %d s"
|
||||
% (volume.id, status, timeout))
|
||||
|
||||
def name_generate(self, prefix='Entity'):
|
||||
"""Generate randomized name for some entity.
|
||||
|
||||
:param prefix: string prefix
|
||||
"""
|
||||
name = "%s-%s" % (prefix, six.text_type(uuid.uuid4()))
|
||||
return name
|
||||
|
@ -10,8 +10,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
from novaclient.tests.functional import base
|
||||
|
||||
|
||||
@ -37,8 +35,7 @@ class TestInstanceCLI(base.ClientTestBase):
|
||||
destroy.
|
||||
|
||||
"""
|
||||
# TODO(sdague): better random name
|
||||
name = str(uuid.uuid4())
|
||||
name = self.name_generate('Instance')
|
||||
|
||||
# Boot via the cli, as we're primarily testing the cli in this test
|
||||
network = self.client.networks.list()[0]
|
||||
|
@ -11,7 +11,6 @@
|
||||
# under the License.
|
||||
|
||||
import time
|
||||
import uuid
|
||||
|
||||
import six.moves
|
||||
|
||||
@ -75,8 +74,7 @@ class TestVolumesAPI(base.ClientTestBase):
|
||||
self.client.servers.list()
|
||||
|
||||
# Create a volume type
|
||||
# TODO(melwitt): Use a better random name
|
||||
name = str(uuid.uuid4())
|
||||
name = self.name_generate('VolumeType')
|
||||
volume_type = self.client.volume_types.create(name)
|
||||
|
||||
# This cleanup tests volume type delete
|
||||
|
Loading…
x
Reference in New Issue
Block a user