Change in vdsm[master]: storagetests: add test for mount.isMounted
ishaby at redhat.com
ishaby at redhat.com
Thu Mar 31 09:31:40 UTC 2016
Idan Shaby has posted comments on this change.
Change subject: storagetests: add test for mount.isMounted
......................................................................
Patch Set 3:
(6 comments)
https://gerrit.ovirt.org/#/c/55180/2//COMMIT_MSG
Commit Message:
Line 5: CommitDate: 2016-03-31 11:35:30 +0300
Line 6:
Line 7: storagetests: add test for mount.isMounted
Line 8:
Line 9: Given a local path, this test verifies that the expected fs_file is
> Given a local path
Done
Line 10: found in /proc/mounts by calling mount.isMounted.
Line 11:
Line 12: Change-Id: I5f2c1c9f9fa03a079e8d94bd91f8e7b4fd43c0ee
Line 13: Related-To: https://bugzilla.redhat.com/1305529
Line 7: storagetests: add test for mount.isMounted
Line 8:
Line 9: Given a local path, this test verifies that the expected fs_file is
Line 10: found in /proc/mounts by calling mount.isMounted.
Line 11:
> This is not very clear. This patch add the missing tests ensuring that moun
Done
Line 12: Change-Id: I5f2c1c9f9fa03a079e8d94bd91f8e7b4fd43c0ee
Line 13: Related-To: https://bugzilla.redhat.com/1305529
https://gerrit.ovirt.org/#/c/55180/2/tests/mountTests.py
File tests/mountTests.py:
Line 31: from nose.plugins.skip import SkipTest
Line 32:
Line 33: from testlib import VdsmTestCase as TestCaseBase
Line 34: from testlib import namedTemporaryDir, temporaryPath
Line 35: from testlib import expandPermutations, permutations
> Don't use \. Instead, add separate import for namedTemporaryDir and tempora
Done
Line 36: from storage.misc import execCmd
Line 37: import storage.mount as mount
Line 38: from testValidation import checkSudo
Line 39: import monkeypatch
Line 277: 0)
Line 278: self.assertFalse('/dev/loop10001' in mount._getLoopFsSpecs())
Line 279:
Line 280:
Line 281: @contextmanager
> This should be in the function docstring:
Done
Line 282: def fake_mounts(mount_lines):
Line 283: """
Line 284: This method gets a list of mount lines,
Line 285: fakes the /proc/mounts and /etc/mtab files
Line 289: Usage example:
Line 290: with fake_mounts([mount_line_1, mount_line_2]):
Line 291: <do something with /proc/mounts or /etc/mtab>
Line 292: """
Line 293: data = b"".join(line + b"\n" for line in mount_lines)
> mount_list -> mount_lines
Done
Line 294: with temporaryPath(data=data) as fake_mounts:
Line 295: with monkeypatch.MonkeyPatchScope([
Line 296: (mount, '_PROC_MOUNTS_PATH', fake_mounts),
Line 297: (mount, '_ETC_MTAB_PATH', fake_mounts),
Line 301:
Line 302: class TestRemoteSdIsMounted(TestCaseBase):
Line 303:
Line 304: def test_is_mounted(self):
Line 305: with fake_mounts(["server:/path "
> Use b"...", in Python 3 you cannot write a string to a file without specify
I get here a sintax error:
*** File "./tests/mountTests.py", line 305
with fake_mounts([b"server:/path "
^
SyntaxError: cannot mix bytes and nonbytes literals
The test passes without this change, why should we change it?
Maybe it is run by Python 2?
Line 306: "/rhev/data-center/mnt/server:_path "
Line 307: "nfs4 defaults 0 0"]):
Line 308: self.assertTrue(mount.isMounted(
Line 309: "/rhev/data-center/mnt/server:_path"))
--
To view, visit https://gerrit.ovirt.org/55180
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I5f2c1c9f9fa03a079e8d94bd91f8e7b4fd43c0ee
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Idan Shaby <ishaby at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Freddy Rolland <frolland at redhat.com>
Gerrit-Reviewer: Idan Shaby <ishaby at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list