From e1ad386f9828a6c9caf3c0cb962a3912c9a3885a Mon Sep 17 00:00:00 2001 From: Chris Suttles Date: Fri, 18 Aug 2017 22:27:43 -0700 Subject: [PATCH] Fix quobyte test_validate_volume_no_mtab_entry Fix test_validate_volume_no_mtab_entry. Currently depends on /etc/mtab, this patches and mocks psutil.disk_partitions, which is the source of the dependency. Change-Id: Ie10b134a1840b1277c0c4059f634a6bafd256c2d Closes-Bug: #1708196 --- nova/tests/unit/virt/libvirt/volume/test_quobyte.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nova/tests/unit/virt/libvirt/volume/test_quobyte.py b/nova/tests/unit/virt/libvirt/volume/test_quobyte.py index a7a9861fcd..73aa16d47e 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_quobyte.py +++ b/nova/tests/unit/virt/libvirt/volume/test_quobyte.py @@ -239,7 +239,9 @@ class QuobyteTestCase(test.NoDBTestCase): stat_mock.assert_called_with(self.TEST_MNT_POINT) part_mock.assert_called_once_with(all=True) - def test_validate_volume_no_mtab_entry(self): + @mock.patch.object(psutil, "disk_partitions") + def test_validate_volume_no_mtab_entry(self, part_mock): + part_mock.return_value = [] # no quobyte@ devices msg = ("No matching Quobyte mount entry for %(mpt)s" " could be found for validation in partition list." % {'mpt': self.TEST_MNT_POINT})