Move OCL tests from test-framework repository
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
31
test/functional/tests/cli/test_cli_help.py
Normal file
31
test/functional/tests/cli/test_cli_help.py
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# Copyright(c) 2019 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
|
||||
import logging
|
||||
import pytest
|
||||
from api.cas import casadm
|
||||
from tests.conftest import base_prepare
|
||||
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("shortcut", [True, False])
|
||||
@pytest.mark.parametrize('prepare_and_cleanup',
|
||||
[{"core_count": 0, "cache_count": 0}],
|
||||
indirect=True)
|
||||
def test_cli_help(prepare_and_cleanup, shortcut):
|
||||
prepare()
|
||||
LOGGER.info("Test run")
|
||||
output = casadm.help(shortcut)
|
||||
LOGGER.info(output.stdout) # TODO:this is tmp, every ssh command shall be logged via executor
|
||||
assert output.stdout[0:33] == "Cache Acceleration Software Linux"
|
||||
# TODO: create yml config for every help command and match the output with it
|
||||
# TODO: for now the assert above is purely for testing flow in the casadm api
|
||||
|
||||
|
||||
def prepare():
|
||||
base_prepare()
|
||||
76
test/functional/tests/cli/test_cli_start_stop.py
Normal file
76
test/functional/tests/cli/test_cli_start_stop.py
Normal file
@@ -0,0 +1,76 @@
|
||||
#
|
||||
# Copyright(c) 2019 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
|
||||
import logging
|
||||
import pytest
|
||||
from api.cas import casadm, casadm_parser
|
||||
from tests.conftest import base_prepare
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType
|
||||
from test_utils.size import Unit, Size
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("shortcut", [True, False])
|
||||
@pytest.mark.parametrize('prepare_and_cleanup',
|
||||
[{"core_count": 0, "cache_count": 1, "cache_type": "optane"}, ],
|
||||
indirect=True)
|
||||
def test_cli_start_stop_default_value(prepare_and_cleanup, shortcut):
|
||||
prepare()
|
||||
cache_device = next(
|
||||
disk for disk in TestRun.dut.disks if disk.disk_type == DiskType.optane)
|
||||
cache_device.create_partitions([Size(500, Unit.MebiByte)])
|
||||
cache_device = cache_device.partitions[0]
|
||||
casadm.start_cache(cache_device, shortcut=shortcut, force=True)
|
||||
|
||||
caches = casadm_parser.get_caches()
|
||||
assert len(caches) == 1
|
||||
assert caches[0].cache_device.system_path == cache_device.system_path
|
||||
|
||||
casadm.stop_cache(cache_id=caches[0].cache_id, shortcut=shortcut)
|
||||
|
||||
output = casadm.list_caches(shortcut=shortcut)
|
||||
caches = casadm_parser.get_caches()
|
||||
assert len(caches) == 0
|
||||
assert output.stdout == "No caches running"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("shortcut", [True, False])
|
||||
@pytest.mark.parametrize('prepare_and_cleanup',
|
||||
[{"core_count": 1, "cache_count": 1, "cache_type": "optane"}],
|
||||
indirect=True)
|
||||
def test_cli_add_remove_default_value(prepare_and_cleanup, shortcut):
|
||||
prepare()
|
||||
cache_device = next(
|
||||
disk for disk in TestRun.dut.disks if disk.disk_type == DiskType.optane)
|
||||
cache_device.create_partitions([Size(500, Unit.MebiByte)])
|
||||
cache_device = cache_device.partitions[0]
|
||||
cache = casadm.start_cache(cache_device, shortcut=shortcut, force=True)
|
||||
|
||||
core_device = next(
|
||||
disk for disk in TestRun.dut.disks if disk.disk_type != DiskType.optane)
|
||||
casadm.add_core(cache, core_device, shortcut=shortcut)
|
||||
|
||||
caches = casadm_parser.get_caches()
|
||||
assert len(caches[0].get_core_devices()) == 1
|
||||
assert caches[0].get_core_devices()[0].core_device.system_path == core_device.system_path
|
||||
|
||||
casadm.remove_core(cache.cache_id, 1, shortcut=shortcut)
|
||||
caches = casadm_parser.get_caches()
|
||||
assert len(caches) == 1
|
||||
assert len(caches[0].get_core_devices()) == 0
|
||||
|
||||
casadm.stop_cache(cache_id=cache.cache_id, shortcut=shortcut)
|
||||
|
||||
output = casadm.list_caches(shortcut=shortcut)
|
||||
caches = casadm_parser.get_caches()
|
||||
assert len(caches) == 0
|
||||
assert output.stdout == "No caches running"
|
||||
|
||||
|
||||
def prepare():
|
||||
base_prepare()
|
||||
Reference in New Issue
Block a user