Francesco Romani has uploaded a new change for review.

Change subject: tests: fix HostStatsThread tests
......................................................................

tests: fix HostStatsThread tests

In commit 4567f368bc3b initial tests for HostStatsThread
were added. Unfortunately, the patch was not rebased
before to be verified, and so it broke master.

The mistake slipped into because the patch applies cleanly
against master.

This patch fixes that in the following way
- mark test as broken: the existing behaviour is *not*
  to continue in presence of errors - see
  http://gerrit.ovirt.org/#/c/29401/ abandoned
  for that reason.
- wrap a real HostSample to be more correct
- add a timeout to avoid hang indefinitely.

Change-Id: Iefeacf5f105384040b4a81f9835faa1fa5033c07
Signed-off-by: Francesco Romani <from...@redhat.com>
---
M tests/samplingTests.py
1 file changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/64/35764/1

diff --git a/tests/samplingTests.py b/tests/samplingTests.py
index 3c4273c..503d934 100644
--- a/tests/samplingTests.py
+++ b/tests/samplingTests.py
@@ -28,6 +28,7 @@
 from vdsm import ipwrapper
 import virt.sampling as sampling
 
+from testValidation import brokentest
 from testlib import permutations, expandPermutations
 from testlib import VdsmTestCase as TestCaseBase
 from monkeypatch import MonkeyPatchScope
@@ -216,6 +217,7 @@
         self._sampleCount = 0
         self._samplingDone = threading.Event()
 
+    @brokentest
     def testContinueWithErrors(self):
         """
         bz1113948: do not give up on errors != TimeoutError
@@ -227,12 +229,13 @@
             if self._sampleCount == self.STOP_SAMPLE:
                 self._hs.stop()
                 self._samplingDone.set()
-            return None  # sampling.HostSample(pid)
+            return sampling.HostSample(1)
 
         with MonkeyPatchScope([(sampling, 'HostSample', WrapHostSample),
                                (sampling.HostStatsThread,
                                    'SAMPLE_INTERVAL_SEC', 0.1)]):
             self._hs = sampling.HostStatsThread(self.log)
             self._hs.start()
-            self._samplingDone.wait()
+            self._samplingDone.wait(3.0)
+            self.assertTrue(self._samplingDone.is_set())
             self.assertTrue(self._sampleCount >= self.STOP_SAMPLE)


-- 
To view, visit http://gerrit.ovirt.org/35764
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iefeacf5f105384040b4a81f9835faa1fa5033c07
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
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to