Fixes in tests and CAS API due to the change with by-id devices paths
Signed-off-by: Katarzyna Lapinska <katarzyna.lapinska@intel.com>
This commit is contained in:
parent
3acb51c922
commit
87f68bb2f5
@ -6,7 +6,6 @@
|
||||
from api.cas.casadm_parser import *
|
||||
from api.cas.cli import *
|
||||
from api.cas.statistics import CacheStats, CacheIoClassStats
|
||||
from storage_devices.device import Device
|
||||
from test_utils.os_utils import *
|
||||
|
||||
|
||||
@ -24,7 +23,7 @@ class Cache:
|
||||
if output.exit_code == 0 and output.stdout.strip():
|
||||
return output.stdout.split()[1]
|
||||
else:
|
||||
raise Exception(f"There is no cache started on {self.cache_device.path}.")
|
||||
raise Exception(f"There is no cache started on {self.cache_device.get_device_id()}.")
|
||||
|
||||
def get_core_devices(self):
|
||||
return get_cores(self.cache_id)
|
||||
|
@ -44,9 +44,9 @@ class Core(Device):
|
||||
output_lines = output.stdout.splitlines()
|
||||
for line in output_lines:
|
||||
split_line = line.split(',')
|
||||
if (split_line[0] == "core"
|
||||
and (split_line[2] == fs_utils.readlink(self.core_device.path)
|
||||
or split_line[5] == self.path)):
|
||||
if split_line[0] == "core" and (
|
||||
split_line[2] == os.path.join("/dev", self.core_device.get_device_id())
|
||||
or split_line[5] == self.path):
|
||||
return {"core_id": split_line[1],
|
||||
"core_device": split_line[2],
|
||||
"status": split_line[3],
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 40c1eaa5f9a16d563d906e0249b5c1416b723fae
|
||||
Subproject commit 0cef09bf95a57c962aff5fc59603930142168c91
|
@ -188,18 +188,19 @@ def base_prepare(item):
|
||||
# stop only those RAIDs, which are comprised of test disks
|
||||
if all(map(lambda device:
|
||||
any(map(lambda disk_path:
|
||||
disk_path in device.path,
|
||||
[bd.path for bd in TestRun.dut.disks])),
|
||||
disk_path in device.get_device_id(),
|
||||
[bd.get_device_id() for bd in TestRun.dut.disks])),
|
||||
raid.array_devices)):
|
||||
raid.umount_all_partitions()
|
||||
raid.remove_partitions()
|
||||
raid.stop()
|
||||
for device in raid.array_devices:
|
||||
Mdadm.zero_superblock(device.path)
|
||||
Mdadm.zero_superblock(os.path.join('/dev', device.get_device_id()))
|
||||
Udev.settle()
|
||||
|
||||
for disk in TestRun.dut.disks:
|
||||
disk.umount_all_partitions()
|
||||
Mdadm.zero_superblock(disk.path)
|
||||
Mdadm.zero_superblock(os.path.join('/dev', disk.get_device_id()))
|
||||
TestRun.executor.run_expect_success("udevadm settle")
|
||||
disk.remove_partitions()
|
||||
create_partition_table(disk, PartitionTable.gpt)
|
||||
|
@ -137,7 +137,11 @@ def test_udev_raid_core():
|
||||
cache_disk.create_partitions([Size(1, Unit.GibiByte)])
|
||||
cache_dev = cache_disk.partitions[0]
|
||||
core_disk = TestRun.disks["core"]
|
||||
core_disk.create_partitions([Size(2, Unit.GibiByte)])
|
||||
core_disk = core_disk.partitions[0]
|
||||
core_disk2 = TestRun.disks["core2"]
|
||||
core_disk2.create_partitions([Size(2, Unit.GibiByte)])
|
||||
core_disk2 = core_disk2.partitions[0]
|
||||
|
||||
with TestRun.step("Create RAID0 volume."):
|
||||
config = RaidConfiguration(
|
||||
|
@ -38,7 +38,6 @@ def test_load_after_clean_shutdown(reboot_type, cache_mode, filesystem):
|
||||
cache_disk = TestRun.disks['cache']
|
||||
cache_disk.create_partitions([Size(1, Unit.GibiByte)])
|
||||
cache_dev = cache_disk.partitions[0]
|
||||
cache_dev_link = cache_dev.get_device_link("/dev/disk/by-id")
|
||||
core_dev = TestRun.disks['core']
|
||||
cache = casadm.start_cache(cache_dev, cache_mode, force=True)
|
||||
core = cache.add_core(core_dev)
|
||||
@ -64,7 +63,6 @@ def test_load_after_clean_shutdown(reboot_type, cache_mode, filesystem):
|
||||
else:
|
||||
power_control = TestRun.plugin_manager.get_plugin('power_control')
|
||||
power_control.power_cycle()
|
||||
cache_dev.path = cache_dev_link.get_target()
|
||||
|
||||
with TestRun.step("Load cache."):
|
||||
casadm.load_cache(cache_dev)
|
||||
|
@ -3,15 +3,18 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
from collections import namedtuple
|
||||
from math import isclose
|
||||
|
||||
import pytest
|
||||
|
||||
from .io_class_common import *
|
||||
from collections import namedtuple
|
||||
from math import isclose
|
||||
from api.cas.statistics import IoClassUsageStats
|
||||
from api.cas import ioclass_config, casadm
|
||||
from core.test_run import TestRun
|
||||
from test_utils.size import Unit, Size
|
||||
from tests.io_class.io_class_common import prepare, mountpoint, run_io_dir, \
|
||||
get_io_class_occupancy, ioclass_config_path, run_io_dir_read, get_io_class_usage
|
||||
from api.cas.cache_config import CacheMode, CacheLineSize
|
||||
from api.cas.ioclass_config import IoClass
|
||||
from api.cas.statistics import IoClassUsageStats
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools import fs_utils
|
||||
from test_tools.disk_utils import Filesystem
|
||||
|
@ -3,14 +3,13 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
import pytest
|
||||
from collections import namedtuple
|
||||
from math import isclose
|
||||
|
||||
import pytest
|
||||
|
||||
from .io_class_common import *
|
||||
from api.cas import ioclass_config, casadm
|
||||
from tests.io_class.io_class_common import prepare, mountpoint, TestRun, Unit, \
|
||||
ioclass_config_path, run_io_dir, get_io_class_dirty, get_io_class_usage, get_io_class_occupancy
|
||||
from api.cas.cache_config import CacheMode, CacheLineSize
|
||||
from api.cas.casadm_params import OutputFormat
|
||||
from api.cas.ioclass_config import IoClass
|
||||
from storage_devices.device import Device
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
|
@ -3,12 +3,17 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
import pytest
|
||||
from collections import namedtuple
|
||||
from math import isclose
|
||||
|
||||
import pytest
|
||||
from recordclass import recordclass
|
||||
|
||||
from .io_class_common import *
|
||||
from api.cas import ioclass_config, casadm
|
||||
from core.test_run_utils import TestRun
|
||||
from test_utils.size import Unit, Size
|
||||
from tests.io_class.io_class_common import prepare, mountpoint, ioclass_config_path, \
|
||||
get_io_class_occupancy, run_io_dir, run_io_dir_read
|
||||
from api.cas.cache_config import CacheMode, CacheLineSize
|
||||
from api.cas.ioclass_config import IoClass
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
|
@ -3,17 +3,19 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
from recordclass import recordclass
|
||||
|
||||
import pytest
|
||||
|
||||
from .io_class_common import *
|
||||
from api.cas import ioclass_config, casadm
|
||||
from core.test_run import TestRun
|
||||
from test_utils.size import Unit, Size
|
||||
from tests.io_class.io_class_common import mountpoint, prepare, ioclass_config_path, \
|
||||
get_io_class_occupancy, run_io_dir
|
||||
from api.cas.cache_config import CacheMode, CacheLineSize
|
||||
from api.cas.ioclass_config import IoClass
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools import fs_utils
|
||||
from test_tools.disk_utils import Filesystem
|
||||
from test_utils.os_utils import sync, Udev
|
||||
from recordclass import recordclass
|
||||
|
||||
|
||||
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||
|
@ -49,8 +49,6 @@ def test_recovery_all_options(cache_mode, cache_line_size, cleaning_policy, file
|
||||
core_disk.create_partitions([Size(2000, Unit.MebiByte)] * 2)
|
||||
cache_device = cache_disk.partitions[0]
|
||||
core_device = core_disk.partitions[0]
|
||||
core_device_link = core_device.get_device_link("/dev/disk/by-id")
|
||||
cache_device_link = cache_device.get_device_link("/dev/disk/by-id")
|
||||
|
||||
test_file = File(os.path.join(mount_point, filename))
|
||||
file_operation(test_file.full_path, pattern, ReadWrite.write)
|
||||
@ -88,8 +86,6 @@ def test_recovery_all_options(cache_mode, cache_line_size, cleaning_policy, file
|
||||
core.unmount()
|
||||
TestRun.LOGGER.info(f"Number of dirty blocks in cache: {cache.get_dirty_blocks()}")
|
||||
power_cycle_dut()
|
||||
cache_device.path = cache_device_link.get_target()
|
||||
core_device.path = core_device_link.get_target()
|
||||
|
||||
with TestRun.step("Try to start cache without load and force option."):
|
||||
try:
|
||||
|
@ -11,6 +11,7 @@ from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskTypeSet, DiskType, DiskTypeLowerThan
|
||||
from test_tools.dd import Dd
|
||||
from test_tools.disk_utils import Filesystem
|
||||
from test_tools.fs_utils import readlink
|
||||
from test_utils import os_utils
|
||||
from test_utils.os_utils import Udev
|
||||
from test_utils.output import CmdException
|
||||
@ -43,8 +44,6 @@ def test_recovery_flush_reset_raw(cache_mode):
|
||||
core_disk.create_partitions([Size(16, Unit.GibiByte)] * 2)
|
||||
cache_device = cache_disk.partitions[0]
|
||||
core_device = core_disk.partitions[0]
|
||||
core_device_link = core_device.get_device_link("/dev/disk/by-id")
|
||||
cache_device_link = cache_device.get_device_link("/dev/disk/by-id")
|
||||
|
||||
with TestRun.step("Create test files."):
|
||||
source_file, target_file = create_test_files(test_file_size)
|
||||
@ -70,12 +69,10 @@ def test_recovery_flush_reset_raw(cache_mode):
|
||||
|
||||
with TestRun.step("Hard reset DUT during data flushing."):
|
||||
power_cycle_dut(wait_for_flush_begin=True, core_device=core_device)
|
||||
cache_device.path = cache_device_link.get_target()
|
||||
core_device.path = core_device_link.get_target()
|
||||
|
||||
with TestRun.step("Copy file from core and check if current md5sum is different than "
|
||||
"before restart."):
|
||||
copy_file(source=core_device_link.get_target(), target=target_file.full_path,
|
||||
copy_file(source=readlink(core_device.path), target=target_file.full_path,
|
||||
size=test_file_size, direct="iflag")
|
||||
compare_files(source_file, target_file, should_differ=True)
|
||||
|
||||
@ -92,7 +89,7 @@ def test_recovery_flush_reset_raw(cache_mode):
|
||||
|
||||
with TestRun.step("Copy test file from core device to temporary location. "
|
||||
"Compare it with the first version – they should be the same."):
|
||||
copy_file(source=core_device_link.get_target(), target=target_file.full_path,
|
||||
copy_file(source=readlink(core_device.path), target=target_file.full_path,
|
||||
size=test_file_size, direct="iflag")
|
||||
compare_files(source_file, target_file)
|
||||
|
||||
@ -123,8 +120,6 @@ def test_recovery_flush_reset_fs(cache_mode, fs):
|
||||
core_disk.create_partitions([Size(16, Unit.GibiByte)] * 2)
|
||||
cache_device = cache_disk.partitions[0]
|
||||
core_device = core_disk.partitions[0]
|
||||
core_device_link = core_device.get_device_link("/dev/disk/by-id")
|
||||
cache_device_link = cache_device.get_device_link("/dev/disk/by-id")
|
||||
|
||||
with TestRun.step(f"Create {fs} filesystem on core."):
|
||||
core_device.create_filesystem(fs)
|
||||
@ -155,8 +150,6 @@ def test_recovery_flush_reset_fs(cache_mode, fs):
|
||||
|
||||
with TestRun.step("Hard reset DUT during data flushing."):
|
||||
power_cycle_dut(True, core_device)
|
||||
cache_device.path = cache_device_link.get_target()
|
||||
core_device.path = core_device_link.get_target()
|
||||
|
||||
with TestRun.step("Load cache."):
|
||||
cache = casadm.load_cache(cache_device)
|
||||
|
Loading…
Reference in New Issue
Block a user