Adam Litke has uploaded a new change for review. Change subject: tests: Add lvsByTag to FakeLVM ......................................................................
tests: Add lvsByTag to FakeLVM lvsByTag is needed to test blockVolumeManifest.getChildren() which will be called by the storage_volume_artifacts_test module. Change-Id: I3f87826f624ce6edaf40e7f86657c4c824aa480b Signed-off-by: Adam Litke <ali...@redhat.com> --- M tests/storagefakelib.py M tests/storagefakelibTests.py 2 files changed, 12 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/57070/1 diff --git a/tests/storagefakelib.py b/tests/storagefakelib.py index e967e9a..cbf3b5d 100644 --- a/tests/storagefakelib.py +++ b/tests/storagefakelib.py @@ -179,6 +179,9 @@ tags -= set(delTags) lv_md['tags'] = tuple(tags) + def lvsByTag(self, vgName, tag): + return [lv for lv in self.getLV(vgName) if tag in lv.tags] + def lvPath(self, vgName, lvName): return os.path.join(self.root, "dev", vgName, lvName) diff --git a/tests/storagefakelibTests.py b/tests/storagefakelibTests.py index 9165bf5..9b00c02 100644 --- a/tests/storagefakelibTests.py +++ b/tests/storagefakelibTests.py @@ -307,6 +307,15 @@ vg = lvm.getVG(self.VG_NAME) self.assertEqual(addtags, vg.tags) + def test_lvsbytag(self): + with self.base_config() as lvm: + lvm.createLV(self.VG_NAME, self.LV_NAME, str(self.LV_SIZE_MB)) + lvm.changeLVTags(self.VG_NAME, self.LV_NAME, addTags=('foo',)) + lvs = lvm.lvsByTag(self.VG_NAME, 'foo') + self.assertEqual(1, len(lvs)) + self.assertEqual(self.LV_NAME, lvs[0].name) + self.assertEqual([], lvm.lvsByTag(self.VG_NAME, 'bar')) + @expandPermutations class FakeLVMGeneralTests(VdsmTestCase): -- To view, visit https://gerrit.ovirt.org/57070 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3f87826f624ce6edaf40e7f86657c4c824aa480b Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Adam Litke <ali...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches