Saggi Mizrahi has uploaded a new change for review.
Change subject: Skip mountTests:MountTests.testLoopMount test if mkfs.ext2 is not installed ......................................................................
Skip mountTests:MountTests.testLoopMount test if mkfs.ext2 is not installed
Change-Id: I7fef7122157dd69f725d793332956a81845dd991 Signed-off-by: Saggi Mizrahi smizrahi@redhat.com --- M tests/mountTests.py 1 file changed, 22 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/9593/1
diff --git a/tests/mountTests.py b/tests/mountTests.py index d9b64f2..6a914e0 100644 --- a/tests/mountTests.py +++ b/tests/mountTests.py @@ -19,14 +19,17 @@ #
from contextlib import contextmanager -from storage.misc import execCmd -import storage.mount as mount -from testValidation import checkSudo - -from testrunner import VdsmTestCase as TestCaseBase +import errno from tempfile import mkstemp, mkdtemp import os import shutil + +from nose.plugins.skip import SkipTest + +from testrunner import VdsmTestCase as TestCaseBase +from storage.misc import execCmd +import storage.mount as mount +from testValidation import checkSudo
FLOPPY_SIZE = (2 ** 20) * 4
@@ -52,11 +55,17 @@ checkSudo(["mount", "-o", "loop", "somefile", "target"]) checkSudo(["umount", "target"]) mpath = mkdtemp() - with createFloppyImage(FLOPPY_SIZE) as path: - m = mount.Mount(path, mpath) - m.mount(mntOpts="loop") - try: - self.assertTrue(m.isMounted()) - finally: - m.umount() - shutil.rmtree(mpath) + try: + with createFloppyImage(FLOPPY_SIZE) as path: + m = mount.Mount(path, mpath) + m.mount(mntOpts="loop") + try: + self.assertTrue(m.isMounted()) + finally: + m.umount() + shutil.rmtree(mpath) + except OSError as e: + if e.errno == errno.ENOENT: + raise SkipTest("cannot execute mkfs.ext2") + + raise
-- To view, visit http://gerrit.ovirt.org/9593 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I7fef7122157dd69f725d793332956a81845dd991 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Saggi Mizrahi smizrahi@redhat.com
Dan Kenigsberg has posted comments on this change.
Change subject: Skip mountTests:MountTests.testLoopMount test if mkfs.ext2 is not installed ......................................................................
Patch Set 2: I would prefer that you didn't submit this
(1 inline comment)
.................................................... File tests/mountTests.py Line 63: self.assertTrue(m.isMounted()) Line 64: finally: Line 65: m.umount() Line 66: shutil.rmtree(mpath) Line 67: except OSError as e: Shouldn't this wrap only the createFloppyImage() call?
What if - due to a bug - mount/umount raise ENOENT?
I know that I'm a bit of a puritan here, but still.. Line 68: if e.errno == errno.ENOENT: Line 69: raise SkipTest("cannot execute mkfs.ext2") Line 70:
-- To view, visit http://gerrit.ovirt.org/9593 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I7fef7122157dd69f725d793332956a81845dd991 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com
Saggi Mizrahi has posted comments on this change.
Change subject: Skip mountTests:MountTests.testLoopMount test if mkfs.ext2 is not installed ......................................................................
Patch Set 2: (1 inline comment)
.................................................... File tests/mountTests.py Line 63: self.assertTrue(m.isMounted()) Line 64: finally: Line 65: m.umount() Line 66: shutil.rmtree(mpath) Line 67: except OSError as e: You can't just break scoping like that Line 68: if e.errno == errno.ENOENT: Line 69: raise SkipTest("cannot execute mkfs.ext2") Line 70:
-- To view, visit http://gerrit.ovirt.org/9593 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I7fef7122157dd69f725d793332956a81845dd991 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com
Dan Kenigsberg has posted comments on this change.
Change subject: Skip mountTests:MountTests.testLoopMount test if mkfs.ext2 is not installed ......................................................................
Patch Set 2: (1 inline comment)
.................................................... File tests/mountTests.py Line 63: self.assertTrue(m.isMounted()) Line 64: finally: Line 65: m.umount() Line 66: shutil.rmtree(mpath) Line 67: except OSError as e: well, you could raise SkipTest inside createFloppyImage. or "ask for permission" before attempting to call createFloppyImage.
but maybe I'm putting a wrong standard to test-only code. Line 68: if e.errno == errno.ENOENT: Line 69: raise SkipTest("cannot execute mkfs.ext2") Line 70:
-- To view, visit http://gerrit.ovirt.org/9593 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I7fef7122157dd69f725d793332956a81845dd991 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com
Saggi Mizrahi has posted comments on this change.
Change subject: Skip mountTests:MountTests.testLoopMount test if mkfs.ext2 is not installed ......................................................................
Patch Set 2: (1 inline comment)
.................................................... File tests/mountTests.py Line 63: self.assertTrue(m.isMounted()) Line 64: finally: Line 65: m.umount() Line 66: shutil.rmtree(mpath) Line 67: except OSError as e: I'll move that, It'll fix it for other tests as well Line 68: if e.errno == errno.ENOENT: Line 69: raise SkipTest("cannot execute mkfs.ext2") Line 70:
-- To view, visit http://gerrit.ovirt.org/9593 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I7fef7122157dd69f725d793332956a81845dd991 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com
Dan Kenigsberg has posted comments on this change.
Change subject: Skip mountTests:MountTests.testLoopMount test if mkfs.ext2 is not installed ......................................................................
Patch Set 3: Verified; Looks good to me, approved
-- To view, visit http://gerrit.ovirt.org/9593 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I7fef7122157dd69f725d793332956a81845dd991 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com
Dan Kenigsberg has submitted this change and it was merged.
Change subject: Skip mountTests:MountTests.testLoopMount test if mkfs.ext2 is not installed ......................................................................
Skip mountTests:MountTests.testLoopMount test if mkfs.ext2 is not installed
Change-Id: I7fef7122157dd69f725d793332956a81845dd991 Signed-off-by: Saggi Mizrahi smizrahi@redhat.com --- M tests/mountTests.py 1 file changed, 16 insertions(+), 6 deletions(-)
Approvals: Dan Kenigsberg: Verified; Looks good to me, approved
-- To view, visit http://gerrit.ovirt.org/9593 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged Gerrit-Change-Id: I7fef7122157dd69f725d793332956a81845dd991 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Saggi Mizrahi smizrahi@redhat.com
vdsm-patches@lists.fedorahosted.org