Change in vdsm[master]: tests: vmstats: make _nic_traffic() more robust

fromani at redhat.com fromani at redhat.com
Wed Mar 2 11:21:55 UTC 2016


Francesco Romani has uploaded a new change for review.

Change subject: tests: vmstats: make _nic_traffic() more robust
......................................................................

tests: vmstats: make _nic_traffic() more robust

vmstats._nic_traffic() should not blown up if one
bulk stats is missing, but, as usual with bulk stats,
should go ahead and gather as much data as possible.

This patch adds the tests to check this.

Change-Id: Iaebda97530a642b55e7e17e2a7b5725a7f05453e
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M tests/vmStatsTests.py
1 file changed, 28 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/55/54255/1

diff --git a/tests/vmStatsTests.py b/tests/vmStatsTests.py
index fcedeca..f718c52 100644
--- a/tests/vmStatsTests.py
+++ b/tests/vmStatsTests.py
@@ -370,6 +370,30 @@
                              0) is None
         )
 
+    @permutations([
+        ['net.0.rx.bytes'], ['net.0.rx.pkts'],
+        ['net.0.rx.errs'], ['net.0.rx.drop'], ['net.0.tx.bytes'],
+        ['net.0.tx.pkts'], ['net.0.tx.errs'], ['net.0.tx.drop'],
+    ])
+    def test_networks_missing_key(self, key):
+        nics = (
+            FakeNic(name='vnet0', model='virtio',
+                    mac_addr='00:1a:4a:16:01:51'),
+        )
+        vm = FakeVM(nics=nics)
+        vm.migrationPending = True
+
+        faulty_bulk_stats = {}
+        faulty_bulk_stats.update(self.bulk_stats)
+        del faulty_bulk_stats[key]
+
+        stats = {}
+        self.assertTrue(
+            vmstats.networks(vm, stats,
+                             self.bulk_stats, faulty_bulk_stats,
+                             1)
+        )
+
 
 class DiskStatsTests(VmStatsTestCase):
 
@@ -556,6 +580,10 @@
         self.id = str(uuid.uuid4())
         self.nics = nics if nics is not None else []
         self.drives = drives if drives is not None else []
+        self.migrationPending = False
+
+    def incomingMigrationPending(self):
+        return self.migrationPending
 
     def getNicDevices(self):
         return self.nics


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaebda97530a642b55e7e17e2a7b5725a7f05453e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list