]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume tests verify realpath usage in mounts 20429/head
authorAlfredo Deza <adeza@redhat.com>
Tue, 13 Feb 2018 18:22:41 +0000 (13:22 -0500)
committerAlfredo Deza <adeza@redhat.com>
Wed, 14 Feb 2018 13:23:51 +0000 (08:23 -0500)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 16eabbc3abb7d03a0808963a9aae6b2ffb3a875b)

src/ceph-volume/ceph_volume/tests/util/test_system.py

index 56b88b3f4aef731e40e3eeb7a25442b9f9096697..a742de4804cefbe3839732e75c193422f29c5a05 100644 (file)
@@ -101,6 +101,18 @@ class TestDeviceIsMounted(object):
     def test_is_mounted_at_destination(self, fake_proc):
         assert system.device_is_mounted('/dev/sda1', destination='/far/lib/ceph/osd/ceph-7') is False
 
+    def test_is_realpath_dev_mounted_at_destination(self, fake_proc, monkeypatch):
+        monkeypatch.setattr(system.os.path, 'realpath', lambda x: '/dev/sda1' if 'foo' in x else x)
+        result = system.device_is_mounted('/dev/maper/foo', destination='/far/lib/ceph/osd/ceph-0')
+        assert result is True
+
+    def test_is_realpath_path_mounted_at_destination(self, fake_proc, monkeypatch):
+        monkeypatch.setattr(
+            system.os.path, 'realpath',
+            lambda x: '/far/lib/ceph/osd/ceph-0' if 'symlink' in x else x)
+        result = system.device_is_mounted('/dev/sda1', destination='/symlink/lib/ceph/osd/ceph-0')
+        assert result is True
+
 
 class TestGetMounts(object):