Merge "Set random name in common function create_server"

This commit is contained in:
Jenkins 2016-10-19 04:15:10 +00:00 committed by Gerrit Code Review
commit 46dba3e456
5 changed files with 10 additions and 21 deletions

View File

@ -172,7 +172,11 @@ class BaseVolumeTest(tempest.test.BaseTestCase):
except Exception:
pass
def create_server(self, name, **kwargs):
def create_server(self, **kwargs):
name = kwargs.get(
'name',
data_utils.rand_name(self.__class__.__name__ + '-instance'))
tenant_network = self.get_tenant_network()
body, _ = compute.create_test_server(
self.os,

View File

@ -55,10 +55,7 @@ class VolumesV2ActionsTest(base.BaseVolumeTest):
@test.services('compute')
def test_attach_detach_volume_to_instance(self):
# Create a server
srv_name = data_utils.rand_name(self.__class__.__name__ + '-Instance')
server = self.create_server(
name=srv_name,
wait_until='ACTIVE')
server = self.create_server(wait_until='ACTIVE')
# Volume is attached and detached successfully from an instance
self.client.attach_volume(self.volume['id'],
instance_uuid=server['id'],
@ -89,10 +86,7 @@ class VolumesV2ActionsTest(base.BaseVolumeTest):
@test.services('compute')
def test_get_volume_attachment(self):
# Create a server
srv_name = data_utils.rand_name(self.__class__.__name__ + '-Instance')
server = self.create_server(
name=srv_name,
wait_until='ACTIVE')
server = self.create_server(wait_until='ACTIVE')
# Verify that a volume's attachment information is retrieved
self.client.attach_volume(self.volume['id'],
instance_uuid=server['id'],

View File

@ -84,9 +84,7 @@ class VolumesBackupsV2Test(base.BaseVolumeTest):
volume = self.create_volume()
self.addCleanup(self.volumes_client.delete_volume,
volume['id'])
server_name = data_utils.rand_name(
self.__class__.__name__ + '-instance')
server = self.create_server(name=server_name, wait_until='ACTIVE')
server = self.create_server(wait_until='ACTIVE')
# Attach volume to instance
self.servers_client.attach_volume(server['id'],
volumeId=volume['id'])

View File

@ -176,10 +176,7 @@ class VolumesV2NegativeTest(base.BaseVolumeTest):
@test.idempotent_id('f5e56b0a-5d02-43c1-a2a7-c9b792c2e3f6')
@test.services('compute')
def test_attach_volumes_with_nonexistent_volume_id(self):
srv_name = data_utils.rand_name(self.__class__.__name__ + '-Instance')
server = self.create_server(
name=srv_name,
wait_until='ACTIVE')
server = self.create_server(wait_until='ACTIVE')
self.assertRaises(lib_exc.NotFound,
self.client.attach_volume,

View File

@ -45,11 +45,7 @@ class VolumesV2SnapshotTestJSON(base.BaseVolumeTest):
def test_snapshot_create_with_volume_in_use(self):
# Create a snapshot when volume status is in-use
# Create a test instance
server_name = data_utils.rand_name(
self.__class__.__name__ + '-instance')
server = self.create_server(
name=server_name,
wait_until='ACTIVE')
server = self.create_server(wait_until='ACTIVE')
self.servers_client.attach_volume(
server['id'], volumeId=self.volume_origin['id'],
device='/dev/%s' % CONF.compute.volume_device_name)