From 4626d874713c0d584a983980a4779b878874e533 Mon Sep 17 00:00:00 2001 From: Kamil Gierszewski Date: Mon, 4 Nov 2024 13:57:50 +0100 Subject: [PATCH] test-conftest: Don't prepare disks if test doesn't use them Signed-off-by: Kamil Gierszewski --- test/functional/tests/conftest.py | 33 +++++++++++++------------------ 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/test/functional/tests/conftest.py b/test/functional/tests/conftest.py index befa6d8..520581d 100644 --- a/test/functional/tests/conftest.py +++ b/test/functional/tests/conftest.py @@ -169,25 +169,20 @@ def base_prepare(item): LvmConfiguration.remove_filters_from_config() raids = Raid.discover() - 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.get_device_id(), - [bd.get_device_id() for bd in TestRun.dut.disks], - ) - ), - 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())) - Udev.settle() + 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.get_device_id(), + [bd.get_device_id() for bd in TestRun.dut.disks])), + 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())) + Udev.settle() RamDisk.remove_all() for disk in TestRun.dut.disks: