[Kimchi-devel] [PATCHv4 2/7] Fix mockmodel reset for objectstore

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Thu Sep 4 09:25:48 UTC 2014


From: Royce Lv <lvroyce at linux.vnet.ibm.com>

In mockmodel reset, we only reset model fields dict
but objectstore remains unchanged,
tasks retained in objecstore making mockmodel task related tests fail.
Reset objectstore to fix this.

Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
 src/kimchi/mockmodel.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index 05e3fa4..d7a21ed 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -64,6 +64,7 @@ class MockModel(object):
     def __init__(self, objstore_loc=None):
         self.reset()
         self.objstore = ObjectStore(objstore_loc)
+        self.objstore_loc = objstore_loc
         self.distros = self._get_distros()
 
     def capabilities_lookup(self, *ident):
@@ -78,6 +79,8 @@ class MockModel(object):
                 'federation': 'off'}
 
     def reset(self):
+        if hasattr(self, 'objstore'):
+            self.objstore = ObjectStore(self.objstore_loc)
         self._mock_vms = {}
         self._mock_screenshots = {}
         self._mock_templates = {}
-- 
1.8.3.2




More information about the Kimchi-devel mailing list