Add init test with different runlevels and test for management device status

Signed-off-by: Katarzyna Lapinska <katarzyna.lapinska@intel.com>
This commit is contained in:
Katarzyna Lapinska
2020-07-02 12:00:18 +02:00
parent 94dda3a7d5
commit 6be612be78
4 changed files with 138 additions and 2 deletions

View File

@@ -0,0 +1,43 @@
#
# Copyright(c) 2020 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
from api.cas import cas_module, casctl
from api.cas.cas_module import CasModule
from core.test_run import TestRun
from test_utils import os_utils
def test_init_status():
"""
title: CAS management device status
description: |
Verify that CAS management device is present in OS only when CAS modules are loaded.
pass_criteria:
- CAS management device present in OS when CAS modules are 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."):
if cas_module.is_cas_management_dev_present():
TestRun.LOGGER.info("CAS management device is present in OS when CAS module is loaded.")
else:
TestRun.fail("CAS management device is not present in OS when CAS module is loaded.")
with TestRun.step("Remove CAS module."):
cas_module.unload_all_cas_modules()
with TestRun.step("Stop CAS service."):
casctl.stop()
with TestRun.step("Check if CAS management device is not present in OS."):
if not cas_module.is_cas_management_dev_present():
TestRun.LOGGER.info(
"CAS management device is not present in OS when CAS module is not loaded.")
else:
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."):
os_utils.load_kernel_module(CasModule.cache.value)
os_utils.load_kernel_module(CasModule.disk.value)
casctl.start()