tests: refactor test_init_status
Signed-off-by: Kamil Gierszewski <kamil.gierszewski@huawei.com>
This commit is contained in:
parent
b3cb1251cc
commit
39c4a3be4e
@ -1,9 +1,10 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2021 Intel Corporation
|
# Copyright(c) 2020-2021 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
import time
|
|
||||||
|
|
||||||
|
import time
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from api.cas import cas_module, casctl
|
from api.cas import cas_module, casctl
|
||||||
@ -22,20 +23,21 @@ def test_init_status():
|
|||||||
- CAS management device present in OS when CAS modules are loaded.
|
- CAS management device present in OS when CAS modules are loaded.
|
||||||
- CAS management device not present in OS when CAS modules are not loaded.
|
- CAS management device not present in OS when CAS modules are not loaded.
|
||||||
"""
|
"""
|
||||||
with TestRun.step("Check if CAS management device is present in OS."):
|
|
||||||
|
with TestRun.step("Check if CAS management device is present in OS"):
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
if cas_module.is_cas_management_dev_present():
|
if cas_module.is_cas_management_dev_present():
|
||||||
TestRun.LOGGER.info("CAS management device is present in OS when CAS module is loaded.")
|
TestRun.LOGGER.info("CAS management device is present in OS when CAS module is loaded.")
|
||||||
else:
|
else:
|
||||||
TestRun.fail("CAS management device is not present in OS when CAS module is loaded.")
|
TestRun.fail("CAS management device is not present in OS when CAS module is loaded.")
|
||||||
|
|
||||||
with TestRun.step("Remove CAS module."):
|
with TestRun.step("Remove CAS module"):
|
||||||
cas_module.unload_all_cas_modules()
|
cas_module.unload_all_cas_modules()
|
||||||
|
|
||||||
with TestRun.step("Stop CAS service."):
|
with TestRun.step("Stop CAS service"):
|
||||||
casctl.stop()
|
casctl.stop()
|
||||||
|
|
||||||
with TestRun.step("Check if CAS management device is not present in OS."):
|
with TestRun.step("Check if CAS management device is not present in OS"):
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
if not cas_module.is_cas_management_dev_present():
|
if not cas_module.is_cas_management_dev_present():
|
||||||
TestRun.LOGGER.info(
|
TestRun.LOGGER.info(
|
||||||
@ -43,7 +45,6 @@ def test_init_status():
|
|||||||
else:
|
else:
|
||||||
TestRun.fail("CAS management device is present in OS when CAS module is not loaded.")
|
TestRun.fail("CAS management device is present in OS when CAS module is not loaded.")
|
||||||
|
|
||||||
with TestRun.step("Load CAS modules and start CAS service."):
|
with TestRun.step("Load CAS modules and start CAS service"):
|
||||||
os_utils.load_kernel_module(CasModule.cache.value)
|
os_utils.load_kernel_module(CasModule.cache.value)
|
||||||
os_utils.load_kernel_module(CasModule.disk.value)
|
|
||||||
casctl.start()
|
casctl.start()
|
||||||
|
Loading…
Reference in New Issue
Block a user