libvirt: Add libvirt version mocks in test_private_destroy_* tests
These tests would would rely on the version of libvirt reported by FakeLibvirt being older than MIN_LIBVIRT_BETTER_SIGKILL_HANDLING instead of ensuring that was the case to exercise certain destroy behaviours. Change-Id: I3571efde0061d9337d6c544d093976ccdd2762e8
This commit is contained in:
parent
30c30f5a59
commit
f0b76cc0f1
@ -16763,7 +16763,11 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||
self.assertRaises(fakelibvirt.libvirtError, conn._destroy,
|
||||
instance)
|
||||
|
||||
def test_private_destroy_ebusy_timeout(self):
|
||||
@mock.patch.object(
|
||||
fakelibvirt.Connection, 'getLibVersion',
|
||||
return_value=versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_LIBVIRT_BETTER_SIGKILL_HANDLING) - 1)
|
||||
def test_private_destroy_ebusy_timeout(self, mock_get_ver):
|
||||
# Tests that _destroy will retry 6 times to destroy the guest when an
|
||||
# EBUSY is raised, but eventually times out and raises the libvirtError
|
||||
ex = fakelibvirt.make_libvirtError(
|
||||
@ -16786,7 +16790,11 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||
|
||||
self.assertEqual(6, mock_guest.poweroff.call_count)
|
||||
|
||||
def test_private_destroy_ebusy_multiple_attempt_ok(self):
|
||||
@mock.patch.object(
|
||||
fakelibvirt.Connection, 'getLibVersion',
|
||||
return_value=versionutils.convert_version_to_int(
|
||||
libvirt_driver.MIN_LIBVIRT_BETTER_SIGKILL_HANDLING) - 1)
|
||||
def test_private_destroy_ebusy_multiple_attempt_ok(self, mock_get_ver):
|
||||
# Tests that the _destroy attempt loop is broken when EBUSY is no
|
||||
# longer raised.
|
||||
ex = fakelibvirt.make_libvirtError(
|
||||
|
Loading…
x
Reference in New Issue
Block a user