Change in vdsm[ovirt-3.6]: tests: improve vmstats.disks coverage

fromani at redhat.com fromani at redhat.com
Wed Feb 24 15:28:10 UTC 2016


Hello Dan Kenigsberg, Milan Zamazal,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/53994

to review the following change.

Change subject: tests: improve vmstats.disks coverage
......................................................................

tests: improve vmstats.disks coverage

vmstats.disks() must be robust in presence of various missing
diks attributes. This patch adds the missing tests to make sure
all known misreportings are covered.

Backport-To: 3.6
Bug-Url: https://bugzilla.redhat.com/1281337
Change-Id: I931d080d66b8a6087b05f01fbdce8fee0cd99039
Signed-off-by: Francesco Romani <fromani at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/50598
Reviewed-by: Milan Zamazal <mzamazal at redhat.com>
Continuous-Integration: Jenkins CI
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
---
M tests/vmStatsTests.py
1 file changed, 36 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/94/53994/1

diff --git a/tests/vmStatsTests.py b/tests/vmStatsTests.py
index aabfbda..16ddb8d 100644
--- a/tests/vmStatsTests.py
+++ b/tests/vmStatsTests.py
@@ -22,8 +22,12 @@
 import uuid
 
 from virt import vmstats
+
+from testValidation import brokentest
+
 from testlib import VdsmTestCase as TestCaseBase
 from testlib import permutations, expandPermutations
+
 
 _FAKE_BULK_STATS = {
     'f3243a90-2e9e-4061-b7b3-a6c585e14857': (
@@ -422,6 +426,38 @@
                                          stats['disks'],
                                          expected_keys)
 
+    @brokentest
+    def test_disk_missing_rate(self):
+        partial_stats = self._drop_stats(
+            ('block.0.rd.bytes', 'block.1.rd.bytes',
+             'block.0.wr.bytes', 'block.1.wr.bytes'))
+
+        interval = 10  # seconds
+        drives = (FakeDrive(name='hdc', size=700 * 1024 * 1024),)
+        testvm = FakeVM(drives=drives)
+
+        stats = {}
+        self.assertNotRaises(vmstats.disks,
+                             testvm, stats,
+                             partial_stats, partial_stats,
+                             interval)
+
+    @brokentest
+    def test_disk_missing_latency(self):
+        partial_stats = self._drop_stats(
+            ('block.0.rd.times', 'block.1.rd.times',
+             'block.0.wr.reqs', 'block.1.wr.reqs'))
+
+        interval = 10  # seconds
+        drives = (FakeDrive(name='hdc', size=700 * 1024 * 1024),)
+        testvm = FakeVM(drives=drives)
+
+        stats = {}
+        self.assertNotRaises(vmstats.disks,
+                             testvm, stats,
+                             partial_stats, partial_stats,
+                             interval)
+
     def _drop_stats(self, keys):
         partial_stats = copy.deepcopy(self.bulk_stats)
         for key in keys:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I931d080d66b8a6087b05f01fbdce8fee0cd99039
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzamazal at redhat.com>


More information about the vdsm-patches mailing list