Francesco Romani has uploaded a new change for review.
Change subject: tests: HostStatsThread: sampling window tests ......................................................................
tests: HostStatsThread: sampling window tests
Add test to ensure that the circular buffer for Host samples works as intended.
Change-Id: If97234d3df93b3b67ace7e3e0eb0df3e5e545776 Signed-off-by: Francesco Romani fromani@redhat.com --- M tests/samplingTests.py 1 file changed, 45 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/78/41878/1
diff --git a/tests/samplingTests.py b/tests/samplingTests.py index a8f6028..696ada3 100644 --- a/tests/samplingTests.py +++ b/tests/samplingTests.py @@ -263,6 +263,51 @@ self._hs = sampling.HostStatsThread(self.log) self.assertEquals(self._hs.get(), expected)
+ def testSamplesWraparound(self): + NUM = sampling.HostStatsThread.AVERAGING_WINDOW + 1 + + class FakeEvent(object): + def __init__(self, *args): + self.counter = 0 + + def isSet(self): + return self.counter >= NUM + + def set(self): + pass + + def wait(self, unused): + self.counter += 1 + + class FakeHostSample(object): + + _COUNTER = 0 + + def __repr__(self): + return "FakeHostSample(id=%i)" % self.id + + def __init__(self, *args): + self.id = FakeHostSample._COUNTER + FakeHostSample._COUNTER += 1 + + def to_connlog(self): + pass + + def connlog_diff(self, *args): + pass + + with MonkeyPatchScope([(sampling, 'HostSample', FakeHostSample)]): + self._hs = sampling.HostStatsThread(self.log) + self._hs._sampleInterval = 0 + # we cannot monkey patch, it will interfer on threading internals + self._hs._stopEvent = FakeEvent() + self._hs.start() + self._hs.join() + first, last = self._hs._samples[0], self._hs._samples[-1] + self.assertEqual(first.id, 1) + self.assertEqual(last.id, + sampling.HostStatsThread.AVERAGING_WINDOW) +
class StatsCacheTests(TestCaseBase):
automation@ovirt.org has posted comments on this change.
Change subject: tests: HostStatsThread: sampling window tests ......................................................................
Patch Set 1:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: tests: HostStatsThread: sampling window tests ......................................................................
Patch Set 2:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Francesco Romani has posted comments on this change.
Change subject: tests: HostStatsThread: sampling window tests ......................................................................
Patch Set 2: Verified+1
verified with make check
automation@ovirt.org has posted comments on this change.
Change subject: tests: HostStatsThread: sampling window tests ......................................................................
Patch Set 3:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Dan Kenigsberg has posted comments on this change.
Change subject: tests: HostStatsThread: sampling window tests ......................................................................
Patch Set 3: Code-Review+2
Dan Kenigsberg has submitted this change and it was merged.
Change subject: tests: HostStatsThread: sampling window tests ......................................................................
tests: HostStatsThread: sampling window tests
Add test to ensure that the circular buffer for Host samples works as intended.
Change-Id: If97234d3df93b3b67ace7e3e0eb0df3e5e545776 Signed-off-by: Francesco Romani fromani@redhat.com Reviewed-on: https://gerrit.ovirt.org/41878 Continuous-Integration: Jenkins CI Reviewed-by: Dan Kenigsberg danken@redhat.com --- M tests/samplingTests.py 1 file changed, 47 insertions(+), 0 deletions(-)
Approvals: Jenkins CI: Passed CI tests Dan Kenigsberg: Looks good to me, approved Francesco Romani: Verified
automation@ovirt.org has posted comments on this change.
Change subject: tests: HostStatsThread: sampling window tests ......................................................................
Patch Set 4:
* Update tracker::IGNORE, no Bug-Url found * Set MODIFIED::IGNORE, no Bug-Url found.
vdsm-patches@lists.fedorahosted.org