Change instance variable to local variable in scenario/image/volume

There are still some unnecessary instance variables, and this is to
change them to local variables.

Change-Id: I9c9e25255e9d84639122156a618f266b91818743
This commit is contained in:
zhufl 2017-02-17 10:16:45 +08:00
parent 7a884c222c
commit 7a8f29dffe
4 changed files with 17 additions and 18 deletions

View File

@ -145,24 +145,24 @@ class ListImagesTest(base.BaseV1ImageTest):
a_formats = ['ami', 'ari', 'aki']
(cls.container_format,
cls.container_format_alt) = CONF.image.container_formats[:2]
container_format_alt) = CONF.image.container_formats[:2]
cls.disk_format, cls.disk_format_alt = CONF.image.disk_formats[:2]
if cls.container_format in a_formats:
cls.disk_format = cls.container_format
if cls.container_format_alt in a_formats:
cls.disk_format_alt = cls.container_format_alt
if container_format_alt in a_formats:
cls.disk_format_alt = container_format_alt
img1 = cls._create_remote_image('one', cls.container_format,
cls.disk_format)
img2 = cls._create_remote_image('two', cls.container_format_alt,
img2 = cls._create_remote_image('two', container_format_alt,
cls.disk_format_alt)
img3 = cls._create_remote_image('dup', cls.container_format,
cls.disk_format)
img4 = cls._create_remote_image('dup', cls.container_format,
cls.disk_format)
img5 = cls._create_standard_image('1', cls.container_format_alt,
img5 = cls._create_standard_image('1', container_format_alt,
cls.disk_format_alt, 42)
img6 = cls._create_standard_image('2', cls.container_format_alt,
img6 = cls._create_standard_image('2', container_format_alt,
cls.disk_format_alt, 142)
img7 = cls._create_standard_image('33', cls.container_format,
cls.disk_format, 142)

View File

@ -23,13 +23,13 @@ class VolumesV2ExtendTest(base.BaseVolumeTest):
@decorators.idempotent_id('9a36df71-a257-43a5-9555-dc7c88e66e0e')
def test_volume_extend(self):
# Extend Volume Test.
self.volume = self.create_volume()
extend_size = int(self.volume['size']) + 1
self.volumes_client.extend_volume(self.volume['id'],
volume = self.create_volume()
extend_size = int(volume['size']) + 1
self.volumes_client.extend_volume(volume['id'],
new_size=extend_size)
waiters.wait_for_volume_status(self.volumes_client,
self.volume['id'], 'available')
volume = self.volumes_client.show_volume(self.volume['id'])['volume']
volume['id'], 'available')
volume = self.volumes_client.show_volume(volume['id'])['volume']
self.assertEqual(int(volume['size']), extend_size)

View File

@ -36,9 +36,8 @@ class TestAggregatesBasicOps(manager.ScenarioTest):
def setup_clients(cls):
super(TestAggregatesBasicOps, cls).setup_clients()
# Use admin client by default
cls.manager = cls.admin_manager
cls.aggregates_client = cls.manager.aggregates_client
cls.hosts_client = cls.manager.hosts_client
cls.aggregates_client = cls.admin_manager.aggregates_client
cls.hosts_client = cls.admin_manager.hosts_client
def _create_aggregate(self, **kwargs):
aggregate = (self.aggregates_client.create_aggregate(**kwargs)

View File

@ -109,13 +109,13 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
self.check_networks()
self.ports = []
self.port_id = None
port_id = None
if boot_with_port:
# create a port on the network and boot with that
self.port_id = self._create_port(self.network['id'])['id']
self.ports.append({'port': self.port_id})
port_id = self._create_port(self.network['id'])['id']
self.ports.append({'port': port_id})
server = self._create_server(self.network, self.port_id)
server = self._create_server(self.network, port_id)
self._check_tenant_network_connectivity()
floating_ip = self.create_floating_ip(server)