From 8598ed72d37b4e45cb8b17698e3156f38e23558d Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 11 Dec 2012 11:56:36 -0800 Subject: Add VirtAPI tests So far, VirtAPI has only been tested indirectly through the other tests and modules that use it. This adds a dedicated set of tests for the VirtAPI abstract class, the virt/fake.py::FakeVirtAPI implementation, as well as the one in compute/manager.py::ComputeVirtAPI. This test helps to ensure that they all have the same method signatures and exhibit the general behavior we expect. At the very least, this should help them from getting out of sync in terms of their API. It also ensures that methods can't be added to VirtAPI without a corresponding test. Note the slight change in the FakeVirtAPI class to fix passing the keyword arguments explicitly, which makes Mock happy. Related (vaguely) to blueprint no-db-compute Change-Id: Ib44379e17fae4df506b0108e20eb66b19195b1ca --- nova/virt/fake.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nova/virt') diff --git a/nova/virt/fake.py b/nova/virt/fake.py index 6f95256be..7f8f9888b 100644 --- a/nova/virt/fake.py +++ b/nova/virt/fake.py @@ -410,12 +410,12 @@ class FakeVirtAPI(virtapi.VirtAPI): return db.instance_get_all_by_host(context, host) def aggregate_get_by_host(self, context, host, key=None): - return db.aggregate_get_by_host(context, host, key) + return db.aggregate_get_by_host(context, host, key=key) def aggregate_metadata_add(self, context, aggregate, metadata, set_delete=False): return db.aggregate_metadata_add(context, aggregate['id'], metadata, - set_delete) + set_delete=set_delete) def aggregate_metadata_delete(self, context, aggregate, key): return db.aggregate_metadata_delete(context, aggregate['id'], key) -- cgit