conftest: execute casadm-related cleanup only if CAS is installed during teardown

Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
This commit is contained in:
Michal Rakowski 2020-01-02 16:34:40 +01:00
parent 97c8d07b77
commit 5edbf2a5a9

View File

@ -94,10 +94,11 @@ def pytest_runtest_teardown():
TestRun.executor.wait_for_connection()
Udev.enable()
unmount_cas_devices()
casadm.remove_all_detached_cores()
casadm.stop_all_caches()
from api.cas.init_config import InitConfig
InitConfig.create_default_init_config()
if installer.check_if_installed():
casadm.remove_all_detached_cores()
casadm.stop_all_caches()
from api.cas.init_config import InitConfig
InitConfig.create_default_init_config()
DeviceMapper.remove_all()
except Exception as ex:
TestRun.LOGGER.warning(f"Exception occured during platform cleanup.\n"