Update TF and functional tests API

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Slawomir Jankowski
2020-12-07 16:52:36 +01:00
committed by Robert Baldyga
parent ecbd4fbe30
commit 17f440de10
56 changed files with 209 additions and 210 deletions

View File

@@ -72,7 +72,7 @@ def test_core_inactive_stats():
dd = (
Dd()
.input("/dev/zero")
.output(core.system_path)
.output(core.path)
.count(1000)
.block_size(Size(4, Unit.KibiByte))
).run()

View File

@@ -126,7 +126,7 @@ def test_flush_inactive_devices():
InitConfig.create_init_config_from_running_configuration()
with TestRun.step("Run random writes to CAS device."):
run_fio([first_core.system_path, second_core.system_path])
run_fio([first_core.path, second_core.path])
with TestRun.step("Stop cache without flushing dirty data."):
cache.stop(no_data_flush=True)
@@ -273,7 +273,7 @@ def test_load_cache_with_inactive_core():
plug_device.unplug()
with TestRun.step("Load cache."):
output = TestRun.executor.run(cli.load_cmd(cache_dev.system_path))
output = TestRun.executor.run(cli.load_cmd(cache_dev.path))
cli_messages.check_stderr_msg(output, cli_messages.load_inactive_core_missing)
with TestRun.step("Plug missing device and stop cache."):
@@ -429,7 +429,7 @@ def test_print_statistics_inactive(cache_mode):
InitConfig.create_init_config_from_running_configuration()
with TestRun.step("Run IO."):
run_fio([first_core.system_path, second_core.system_path])
run_fio([first_core.path, second_core.path])
with TestRun.step("Print statistics and check if there is no inactive usage section."):
active_stats = cache.get_statistics()
@@ -460,7 +460,7 @@ def test_print_statistics_inactive(cache_mode):
time.sleep(1)
first_core_status = first_core.get_status()
if first_core_status != CoreStatus.active:
TestRun.fail(f"Core {first_core.system_path} should be in active state but it is not. "
TestRun.fail(f"Core {first_core.path} should be in active state but it is not. "
f"Actual state: {first_core_status}.")
with TestRun.step("Check cache statistics section of inactive devices."):
@@ -543,7 +543,7 @@ def test_remove_detached_cores():
InitConfig.create_init_config_from_running_configuration()
with TestRun.step("Run random writes to all CAS devices."):
run_fio([c.system_path for c in cores])
run_fio([c.path for c in cores])
with TestRun.step("Flush dirty data from two CAS devices and verify than other two contain "
"dirty data."):
@@ -577,7 +577,7 @@ def test_remove_detached_cores():
with TestRun.step("Verify that cores are no longer listed."):
output = casadm.list_caches().stdout
for dev in core_devs:
if dev.system_path in output:
if dev.path in output:
TestRun.fail(f"CAS device is still listed in casadm list output:\n{output}")
@@ -612,7 +612,7 @@ def test_remove_inactive_devices():
InitConfig.create_init_config_from_running_configuration()
with TestRun.step("Run random writes to all CAS devices."):
run_fio([c.system_path for c in cores])
run_fio([c.path for c in cores])
with TestRun.step("Flush dirty data from two CAS devices and verify than other two "
"contain dirty data."):
@@ -657,7 +657,7 @@ def test_remove_inactive_devices():
"dirty CAS device as expected.")
cli_messages.check_stderr_msg(e.output, cli_messages.remove_inactive_core)
output = casadm.list_caches().stdout
if core.system_path not in output:
if core.path not in output:
TestRun.fail(f"CAS device is not listed in casadm list output but it should be."
f"\n{output}")
core.remove_core(force=True)
@@ -695,7 +695,7 @@ def test_stop_cache_with_inactive_devices():
InitConfig.create_init_config_from_running_configuration()
with TestRun.step("Run random writes and verify that CAS device contains dirty data."):
run_fio([core.system_path])
run_fio([core.path])
if core.get_dirty_blocks() == Size.zero():
TestRun.fail("There is no dirty data on core device.")

View File

@@ -203,10 +203,10 @@ def test_udev_cache_load(cache_mode):
elif len(caches) > 1:
caches_list = '\n'.join(caches)
TestRun.fail(f"There is more than 1 cache loaded:\n{caches_list}")
elif caches[0].cache_device.system_path != cache_dev.system_path:
elif caches[0].cache_device.path != cache_dev.path:
TestRun.fail(f"Cache loaded on wrong device. "
f"Actual: {caches[0].cache_device.system_path}, "
f"expected: {cache_dev.system_path}")
f"Actual: {caches[0].cache_device.path}, "
f"expected: {cache_dev.path}")
elif caches[0].get_cache_mode() != cache_mode:
TestRun.fail(f"Cache did load with different cache mode. "
f"Actual: {caches[0].get_cache_mode()}, expected: {cache_mode}")
@@ -268,7 +268,7 @@ def test_neg_udev_cache_load():
if len(cas_devices["caches"]) != 1:
TestRun.LOGGER.error(f"There is wrong number of caches. Expected: 1, actual: "
f"{len(cas_devices['caches'])}")
elif cas_devices["caches"][1]["device"] != cache_disk.partitions[0].system_path or \
elif cas_devices["caches"][1]["device"] != cache_disk.partitions[0].path or \
CacheStatus[(cas_devices["caches"][1]["status"]).lower()] != CacheStatus.running:
TestRun.LOGGER.error(f"Cache did not load properly: {cas_devices['caches'][1]}")
if len(cas_devices["cores"]) != 2:
@@ -277,7 +277,7 @@ def test_neg_udev_cache_load():
correct_core_devices = []
for i in first_cache_core_numbers:
correct_core_devices.append(core_disk.partitions[i].system_path)
correct_core_devices.append(core_disk.partitions[i].path)
for core in cas_devices["cores"].values():
if core["device"] not in correct_core_devices or \
CoreStatus[core["status"].lower()] != CoreStatus.active or \
@@ -297,7 +297,7 @@ def test_neg_udev_cache_load():
core_pool_expected_devices = []
for i in range(0, cores_count):
if i not in first_cache_core_numbers:
core_pool_expected_devices.append(core_disk.partitions[i].system_path)
core_pool_expected_devices.append(core_disk.partitions[i].path)
for c in cas_devices["core_pool"]:
if c["device"] not in core_pool_expected_devices:
TestRun.LOGGER.error(f"Wrong core device added to core pool: {c}.")
@@ -305,11 +305,11 @@ def test_neg_udev_cache_load():
def check_if_dev_in_core_pool(dev, should_be_in_core_pool=True):
cas_devices_dict = casadm_parser.get_cas_devices_dict()
is_in_core_pool = any(dev.system_path == d["device"] for d in cas_devices_dict["core_pool"])
is_in_core_pool = any(dev.path == d["device"] for d in cas_devices_dict["core_pool"])
if not (should_be_in_core_pool ^ is_in_core_pool):
TestRun.LOGGER.info(f"Core device {dev.system_path} is"
TestRun.LOGGER.info(f"Core device {dev.path} is"
f"{'' if should_be_in_core_pool else ' not'} listed in core pool "
f"as expected.")
else:
TestRun.fail(f"Core device {dev.system_path} is{' not' if should_be_in_core_pool else ''} "
TestRun.fail(f"Core device {dev.path} is{' not' if should_be_in_core_pool else ''} "
f"listed in core pool.")