From bf7711354d8b5ce5870903457633102bd2f83eb7 Mon Sep 17 00:00:00 2001 From: Kamil Gierszewski Date: Wed, 6 Nov 2024 14:00:14 +0100 Subject: [PATCH] test-conftest: More readable RAID teardown Signed-off-by: Kamil Gierszewski --- test/functional/tests/conftest.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/functional/tests/conftest.py b/test/functional/tests/conftest.py index 410b99c..8a65d58 100644 --- a/test/functional/tests/conftest.py +++ b/test/functional/tests/conftest.py @@ -172,16 +172,13 @@ def base_prepare(item): if len(TestRun.disks): for raid in raids: # stop only those RAIDs, which are comprised of test disks - if all(map(lambda device: - any(map(lambda disk_path: - disk_path in device.device_id, - [bd.device_id for bd in TestRun.dut.disks])), - raid.array_devices)): + test_run_disk_ids = {dev.device_id for dev in TestRun.disks.values()} + if filter(lambda dev: dev.device_id in test_run_disk_ids, raid.array_devices): raid.remove_partitions() raid.unmount() raid.stop() for device in raid.array_devices: - Mdadm.zero_superblock(posixpath.join('/dev', device.get_device_id())) + Mdadm.zero_superblock(posixpath.join("/dev", device.get_device_id())) Udev.settle() RamDisk.remove_all()