From 01569b42d6537574baf6831a96da243fdb1948d2 Mon Sep 17 00:00:00 2001 From: Matthew Booth Date: Wed, 3 Jan 2018 09:49:25 +0000 Subject: [PATCH] Remove redundant swap_volume tests Change I36b2e2ae introduced several unit tests designed to test a fix for a bug in swap_volume caused by BDM mangling. Change If74dd9d8 subsequently removed the BDM mangling, which made the tests irrelevant. It also removed the only user of the source_type argument to _test_swap_volume_driver, which was the only differentiator between the tests, meaning the tests were all identical. Change-Id: I851a565c06ef2dc3d3d4a530aeb7f89e58f00046 --- nova/tests/unit/virt/libvirt/test_driver.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index e5425a462c..e20f60d990 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -15295,9 +15295,8 @@ class LibvirtConnTestCase(test.NoDBTestCase, @mock.patch('nova.virt.libvirt.driver.LibvirtDriver._get_volume_config') @mock.patch('nova.virt.libvirt.driver.LibvirtDriver._connect_volume') @mock.patch('nova.virt.libvirt.host.Host.get_guest') - def _test_swap_volume_driver(self, get_guest, connect_volume, - get_volume_config, swap_volume, - disconnect_volume, source_type): + def test_swap_volume(self, get_guest, connect_volume, get_volume_config, + swap_volume, disconnect_volume): conn = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI()) instance = objects.Instance(**self.test_instance) old_connection_info = {'driver_volume_type': 'fake', @@ -15335,15 +15334,6 @@ class LibvirtConnTestCase(test.NoDBTestCase, disconnect_volume.assert_called_once_with(old_connection_info, instance) - def test_swap_volume_driver_source_is_volume(self): - self._test_swap_volume_driver(source_type='volume') - - def test_swap_volume_driver_source_is_image(self): - self._test_swap_volume_driver(source_type='image') - - def test_swap_volume_driver_source_is_snapshot(self): - self._test_swap_volume_driver(source_type='snapshot') - @mock.patch('nova.virt.libvirt.guest.BlockDevice.rebase') @mock.patch('nova.virt.libvirt.driver.LibvirtDriver._disconnect_volume') @mock.patch('nova.virt.libvirt.driver.LibvirtDriver._connect_volume')