Francesco Romani has uploaded a new change for review.

Change subject: tests: improve periodicTests.py
......................................................................

tests: improve periodicTests.py

document a bit better the code and make it easier to understand
the test failures.

Change-Id: I75b890daed01d23cfa0a36db66615a48023b96c0
Signed-off-by: Francesco Romani <from...@redhat.com>
---
M tests/periodicTests.py
1 file changed, 18 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/53/65753/1

diff --git a/tests/periodicTests.py b/tests/periodicTests.py
index 4cc2b21..4df36d6 100644
--- a/tests/periodicTests.py
+++ b/tests/periodicTests.py
@@ -219,6 +219,9 @@
 
     @permutations(VM_IDS)
     def test_dispatch(self, failed_ids):
+        """
+        check that we dispatch even if for any reason required() raises.
+        """
         for i in failed_ids:
             with self.cif.vmContainerLock:
                 vm_id = _fake_vm_id(i)
@@ -257,16 +260,17 @@
         # we don't care about executor (hence the simplistic fake)
         op()
 
+        for vm_id in skip_ids:
+            self.assertNotIn(_fake_vm_id(vm_id), _Visitor.VMS)
+
         vms = self.cif.getVMs()
+
         expected = (
             set(vms.keys()) -
             set(_fake_vm_id(i) for i in skip_ids)
         )
         for vm_id in expected:
             self.assertEqual(_Visitor.VMS.get(vm_id), 1)
-
-        for vm_id in skip_ids:
-            self.assertEqual(_Visitor.VMS.get(vm_id), None)
 
     def _make_fake_vms(self):
         for i in range(VM_NUM):
@@ -391,3 +395,14 @@
 
     def updateNumaInfo(self):
         pass
+
+    def __repr__(self):
+        return (
+            "<VM=%s name=%s migrating=%s "
+            "monitorable=%s ready=%s "
+            "fail_required=%s fail_runnable=%s>" % (
+            self.id, self.name, self.migrating,
+            self.monitorable, self.ready,
+            getattr(self, 'fail_required', False),
+            getattr(self, 'fail_runnable', False))
+        )


-- 
To view, visit https://gerrit.ovirt.org/65753
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I75b890daed01d23cfa0a36db66615a48023b96c0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <from...@redhat.com>
_______________________________________________
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org

Reply via email to