From: Erwan Velu Date: Tue, 23 Feb 2016 15:14:48 +0000 (+0100) Subject: tests/ceph-disk: Using dummy device mappers X-Git-Tag: v10.1.0~317^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=57f31e9536076da333062ee161021d78e3f542fa;p=ceph.git tests/ceph-disk: Using dummy device mappers When doing a make test, if your local setup was running a "dm-0" or "dm-1", the make check was failing. The detection of the local "dm-x" were leading to a wrong comparaison with the expected simulated values. The fix is using a dummy name for that "dm" to prevent any collision with the local setup. Prior that patch, a typical output of that error looked like : > assert expect == main.list_devices() E assert [{'partitions...: '/dev/Xda'}] == [{'partitions'...: '/dev/Xda'}] E At index 0 diff: {'partitions': [{'dmcrypt': {'holders': ['dm-0'], 'type': 'plain'}, 'ptype': '4fbd7e29-9d25-41b8-afd0-5ec00ceff05d', 'path': '/dev/Xda1', 'is_partition': True, 'mount': None, 'uuid': '56244cf5-83ef-4984-888a-2d8b8e0e04b2', 'type': 'data', 'state': 'unprepared', 'fs_type': None}], 'path': '/dev/Xda'} != {'partitions': [{'ptype': '4fbd7e29-9d25-41b8-afd0-5ec00ceff05d', 'whoami': None, 'path': '/dev/Xda1', 'is_partition': True, 'mount': '/var/cache/ccache', 'uuid': '56244cf5-83ef-4984-888a-2d8b8e0e04b2', 'ceph_fsid': None, 'fs_type': 'btrfs', 'dmcrypt': {'holders': ['dm-0'], 'type': 'plain'}, 'type': 'data', 'state': 'active'}], 'path': '/dev/Xda'} E Full diff: E - [{'partitions': [{'dmcrypt': {'holders': ['dm-0'], 'type': 'plain'}, E + [{'partitions': [{'ceph_fsid': None, E + 'dmcrypt': {'holders': ['dm-0'], 'type': 'plain'}, E - 'fs_type': None, E ? ^^^^ E + 'fs_type': 'btrfs', E ? ^^^^^^^ E 'is_partition': True, E - 'mount': None, E + 'mount': '/var/cache/ccache', E 'path': '/dev/Xda1', E 'ptype': '4fbd7e29-9d25-41b8-afd0-5ec00ceff05d', E - 'state': 'unprepared', E ? ^^^^ ----- E + 'state': 'active', E ? ^^^^^ E 'type': 'data', E - 'uuid': '56244cf5-83ef-4984-888a-2d8b8e0e04b2'}], E ? -- E + 'uuid': '56244cf5-83ef-4984-888a-2d8b8e0e04b2', E + 'whoami': None}], E 'path': '/dev/Xda'}] tests/test_main.py:342: AssertionError Signed-off-by: Erwan Velu --- diff --git a/src/ceph-disk/tests/test_main.py b/src/ceph-disk/tests/test_main.py index fe85eb720de8..9b4489237e7c 100644 --- a/src/ceph-disk/tests/test_main.py +++ b/src/ceph-disk/tests/test_main.py @@ -315,7 +315,7 @@ class TestCephDisk(object): partition_uuid = "56244cf5-83ef-4984-888a-2d8b8e0e04b2" disk = "Xda" partition = "Xda1" - holders = ["dm-0"] + holders = ["dm-dummy"] with patch.multiple( main, is_held=lambda dev: holders, @@ -346,7 +346,7 @@ class TestCephDisk(object): partition_uuid = "56244cf5-83ef-4984-888a-2d8b8e0e04b2" disk = "Xda" partition = "Xda1" - holders = ["dm-0", "dm-1"] + holders = ["dm-dummy", "dm-dummy1"] with patch.multiple( main, is_held=lambda dev: holders, @@ -451,9 +451,9 @@ class TestCephDisk(object): data_uuid = "56244cf5-83ef-4984-888a-2d8b8e0e04b2" disk = "Xda" data = "Xda1" - data_holder = "dm-0" + data_holder = "dm-dummy" space = "Xda2" - space_holder = "dm-0" + space_holder = "dm-dummy" mount_path = '/mount/path' fs_type = 'ext4' space_uuid = "7ad5e65a-0ca5-40e4-a896-62a74ca61c55"