From 1f81c086579a0867f9aecd2d5d7cc531b4d3347f Mon Sep 17 00:00:00 2001 From: Lee Yarwood Date: Tue, 28 Jul 2020 14:12:56 +0100 Subject: [PATCH] func: Add CinderFixture to _IntegratedTestBase As with Neutron this fixture is used often enough by users of _IntegratedTestBase that it's worth being in the class itself. Change-Id: I2e4c875533d8088c8454adc799539b10dcfc37dc --- nova/tests/functional/compute/test_live_migration.py | 5 ----- nova/tests/functional/integrated_helpers.py | 1 + nova/tests/functional/regressions/test_bug_1404867.py | 2 -- nova/tests/functional/regressions/test_bug_1732947.py | 5 ----- nova/tests/functional/regressions/test_bug_1889108.py | 4 ---- nova/tests/functional/test_boot_from_volume.py | 1 - nova/tests/functional/test_conf_max_attach_disk_devices.py | 4 ---- nova/tests/functional/test_multiattach.py | 1 - nova/tests/functional/test_servers.py | 3 --- 9 files changed, 1 insertion(+), 25 deletions(-) diff --git a/nova/tests/functional/compute/test_live_migration.py b/nova/tests/functional/compute/test_live_migration.py index 160a898bda4e..aded902befeb 100644 --- a/nova/tests/functional/compute/test_live_migration.py +++ b/nova/tests/functional/compute/test_live_migration.py @@ -54,7 +54,6 @@ class LiveMigrationCinderFailure(integrated_helpers._IntegratedTestBase): self.compute2 = self.start_service('compute', host='host2') def test_live_migrate_attachment_delete_fails(self): - self.useFixture(nova_fixtures.CinderFixture(self)) server = self.api.post_server({ 'server': { 'flavorRef': 1, @@ -105,10 +104,6 @@ class TestVolAttachmentsDuringLiveMigration( ADMIN_API = True microversion = 'latest' - def setUp(self): - super().setUp() - self.cinder = self.useFixture(nova_fixtures.CinderFixture(self)) - def _setup_compute_service(self): self._start_compute('src') self._start_compute('dest') diff --git a/nova/tests/functional/integrated_helpers.py b/nova/tests/functional/integrated_helpers.py index b46f690b4425..5f9a84da4aca 100644 --- a/nova/tests/functional/integrated_helpers.py +++ b/nova/tests/functional/integrated_helpers.py @@ -998,6 +998,7 @@ class _IntegratedTestBase(test.TestCase, PlacementInstanceHelperMixin): self.placement_api = placement.api self.neutron = self.useFixture(nova_fixtures.NeutronFixture(self)) + self.cinder = self.useFixture(nova_fixtures.CinderFixture(self)) fake_notifier.stub_notifier(self) self.addCleanup(fake_notifier.reset) diff --git a/nova/tests/functional/regressions/test_bug_1404867.py b/nova/tests/functional/regressions/test_bug_1404867.py index 4581e1f0e4a7..40fc199ad690 100644 --- a/nova/tests/functional/regressions/test_bug_1404867.py +++ b/nova/tests/functional/regressions/test_bug_1404867.py @@ -57,8 +57,6 @@ class DeleteWithReservedVolumes(integrated_helpers._IntegratedTestBase): return self._wait_for_state_change(server, 'ERROR') def test_delete_with_reserved_volumes_new(self): - self.cinder = self.useFixture( - nova_fixtures.CinderFixture(self)) # Create a server which should go to ERROR state because we don't # have any active computes. diff --git a/nova/tests/functional/regressions/test_bug_1732947.py b/nova/tests/functional/regressions/test_bug_1732947.py index a373c62c4c2f..3637f40bc2b4 100644 --- a/nova/tests/functional/regressions/test_bug_1732947.py +++ b/nova/tests/functional/regressions/test_bug_1732947.py @@ -30,11 +30,6 @@ class RebuildVolumeBackedSameImage(integrated_helpers._IntegratedTestBase): api_major_version = 'v2.1' microversion = 'latest' - def setUp(self): - super(RebuildVolumeBackedSameImage, self).setUp() - # We are creating a volume-backed server so we need the CinderFixture. - self.useFixture(nova_fixtures.CinderFixture(self)) - def _setup_scheduler_service(self): # Add the IsolatedHostsFilter to the list of enabled filters since it # is not enabled by default. diff --git a/nova/tests/functional/regressions/test_bug_1889108.py b/nova/tests/functional/regressions/test_bug_1889108.py index 0feee54846bd..6c6d1a86fdb6 100644 --- a/nova/tests/functional/regressions/test_bug_1889108.py +++ b/nova/tests/functional/regressions/test_bug_1889108.py @@ -31,10 +31,6 @@ class TestVolAttachmentsDuringPreLiveMigration( ADMIN_API = True microversion = 'latest' - def setUp(self): - super().setUp() - self.cinder = self.useFixture(nova_fixtures.CinderFixture(self)) - def _setup_compute_service(self): self._start_compute('src') self._start_compute('dest') diff --git a/nova/tests/functional/test_boot_from_volume.py b/nova/tests/functional/test_boot_from_volume.py index 5582140d7dd6..9eff36ea58c7 100644 --- a/nova/tests/functional/test_boot_from_volume.py +++ b/nova/tests/functional/test_boot_from_volume.py @@ -53,7 +53,6 @@ class BootFromVolumeTest(integrated_helpers._IntegratedTestBase): self.flags(allow_resize_to_same_host=True) super(BootFromVolumeTest, self).setUp() self.admin_api = self.api_fixture.admin_api - self.useFixture(nova_fixtures.CinderFixture(self)) def test_boot_from_volume_larger_than_local_gb(self): # Verify no local disk is being used currently diff --git a/nova/tests/functional/test_conf_max_attach_disk_devices.py b/nova/tests/functional/test_conf_max_attach_disk_devices.py index 3b35d2f07f64..517a65b055e0 100644 --- a/nova/tests/functional/test_conf_max_attach_disk_devices.py +++ b/nova/tests/functional/test_conf_max_attach_disk_devices.py @@ -20,10 +20,6 @@ from nova.tests.functional import integrated_helpers class ConfigurableMaxDiskDevicesTest(integrated_helpers._IntegratedTestBase): - def setUp(self): - super(ConfigurableMaxDiskDevicesTest, self).setUp() - self.cinder = self.useFixture( - nova_fixtures.CinderFixture(self)) def _wait_for_volume_attach(self, server_id, volume_id): for i in range(0, 100): diff --git a/nova/tests/functional/test_multiattach.py b/nova/tests/functional/test_multiattach.py index 12feee17259c..c3c307d47130 100644 --- a/nova/tests/functional/test_multiattach.py +++ b/nova/tests/functional/test_multiattach.py @@ -31,7 +31,6 @@ class TestMultiattachVolumes(integrated_helpers._IntegratedTestBase): # multiattach. self.useFixture(nova_fixtures.AllServicesCurrent()) super(TestMultiattachVolumes, self).setUp() - self.useFixture(nova_fixtures.CinderFixture(self)) def test_boot_from_volume_and_attach_to_second_server(self): """This scenario creates a server from the multiattach volume, waits diff --git a/nova/tests/functional/test_servers.py b/nova/tests/functional/test_servers.py index 1fcc7cdf71f7..d85e148ee751 100644 --- a/nova/tests/functional/test_servers.py +++ b/nova/tests/functional/test_servers.py @@ -767,8 +767,6 @@ class ServersTest(integrated_helpers._IntegratedTestBase): self.assertEqual(403, ex.response.status_code) def test_attach_vol_maximum_disk_devices_exceeded(self): - self.useFixture(nova_fixtures.CinderFixture(self)) - server = self._build_server() created_server = self.api.post_server({"server": server}) server_id = created_server['id'] @@ -1493,7 +1491,6 @@ class ServerRebuildTestCase(integrated_helpers._IntegratedTestBase): different image than what is in the root disk of the root volume will result in a 400 BadRequest error. """ - self.useFixture(nova_fixtures.CinderFixture(self)) # First create our server as normal. server_req_body = { # There is no imageRef because this is boot from volume.