diff options
| author | Jenkins <jenkins@review.openstack.org> | 2011-11-10 04:11:12 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2011-11-10 04:11:12 +0000 |
| commit | 260568339c3666fc37abbe63aaaa76abc3d900b3 (patch) | |
| tree | a786c592a221d8318f1f8feceaf658d6c543331c /nova/tests | |
| parent | 6fa35344f98aff915051242b9daff7ad38e47756 (diff) | |
| parent | ad7fcf225e126d2a719c04019c4daa1616d2159e (diff) | |
Merge "Undefine libvirt saved instances"
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/test_libvirt.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py index 28af606bc..d0ca361ad 100644 --- a/nova/tests/test_libvirt.py +++ b/nova/tests/test_libvirt.py @@ -1063,6 +1063,25 @@ class LibvirtConnTestCase(test.TestCase): instance = db.instance_create(self.context, self.test_instance) conn.destroy(instance, {}) + @test.skip_if(missing_libvirt(), "Test requires libvirt") + def test_destroy_saved(self): + """Ensure destroy calls managedSaveRemove for saved instance""" + mock = self.mox.CreateMock(libvirt.virDomain) + mock.destroy() + mock.hasManagedSaveImage(0).AndReturn(1) + mock.managedSaveRemove(0) + mock.undefine() + + self.mox.ReplayAll() + + def fake_lookup_by_name(instance_name): + return mock + + conn = connection.LibvirtConnection(False) + self.stubs.Set(conn, '_lookup_by_name', fake_lookup_by_name) + instance = {"name": "instancename", "id": "instanceid"} + conn.destroy(instance, []) + class HostStateTestCase(test.TestCase): |
