summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ceilometer/tests/unit/compute/test_discovery.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/ceilometer/tests/unit/compute/test_discovery.py b/ceilometer/tests/unit/compute/test_discovery.py
index e5c1c964..e726d631 100644
--- a/ceilometer/tests/unit/compute/test_discovery.py
+++ b/ceilometer/tests/unit/compute/test_discovery.py
@@ -128,6 +128,9 @@ class FakeManualInstanceConn(object):
def listAllDomains(self):
return [FakeManualInstanceDomain()]
+ def isAlive(self):
+ return False
+
class TestDiscovery(base.BaseTestCase):
@@ -286,14 +289,13 @@ class TestDiscovery(base.BaseTestCase):
self.client.instance_get_all_by_host.call_args_list)
@testtools.skipUnless(libvirt, "libvirt not available")
- @mock.patch.object(utils, "libvirt")
- @mock.patch.object(discovery, "libvirt")
- def test_discovery_with_libvirt_error(self, libvirt, libvirt2):
+ @mock.patch.object(libvirt, "VIR_DOMAIN_METADATA_ELEMENT", 2)
+ @mock.patch.object(libvirt, "openReadOnly")
+ def test_discovery_with_libvirt_error(self, openReadOnly):
self.CONF.set_override("instance_discovery_method",
"libvirt_metadata",
group="compute")
- libvirt.VIR_DOMAIN_METADATA_ELEMENT = 2
- libvirt2.openReadOnly.return_value = FakeManualInstanceConn()
+ openReadOnly.return_value = FakeManualInstanceConn()
dsc = discovery.InstanceDiscovery(self.CONF)
resources = dsc.discover(mock.MagicMock())
self.assertEqual(0, len(resources))