]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume tests verify realpath usage in mounts 20427/head
authorAlfredo Deza <adeza@redhat.com>
Tue, 13 Feb 2018 18:22:41 +0000 (13:22 -0500)
committerAlfredo Deza <adeza@redhat.com>
Tue, 13 Feb 2018 20:55:11 +0000 (15:55 -0500)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
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):