Fix imports
Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#
|
||||
# Copyright(c) 2019-2021 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#
|
||||
# Copyright(c) 2019-2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
|
@@ -6,15 +6,13 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import test_tools.fs_tools
|
||||
from api.cas import casadm, casadm_parser, cli
|
||||
from api.cas.cache_config import CacheMode, CleaningPolicy, CacheModeTrait
|
||||
from api.cas.casadm_parser import wait_for_flushing
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools import fs_tools
|
||||
from test_tools.dd import Dd
|
||||
from test_tools.fs_tools import Filesystem
|
||||
from test_tools.fs_tools import Filesystem, create_random_test_file
|
||||
from test_tools.os_tools import DropCachesMode, sync, drop_caches
|
||||
from test_tools.udev import Udev
|
||||
from type_def.size import Size, Unit
|
||||
@@ -55,7 +53,7 @@ def test_interrupt_core_flush(cache_mode, filesystem):
|
||||
cache.set_cleaning_policy(CleaningPolicy.nop)
|
||||
|
||||
with TestRun.step(f"Add core device with {filesystem} filesystem and mount it."):
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core_part.create_filesystem(filesystem)
|
||||
core = cache.add_core(core_part)
|
||||
core.mount(mount_point)
|
||||
|
||||
@@ -139,7 +137,7 @@ def test_interrupt_cache_flush(cache_mode, filesystem):
|
||||
cache.set_cleaning_policy(CleaningPolicy.nop)
|
||||
|
||||
with TestRun.step(f"Add core device with {filesystem} filesystem and mount it."):
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core_part.create_filesystem(filesystem)
|
||||
core = cache.add_core(core_part)
|
||||
core.mount(mount_point)
|
||||
|
||||
@@ -226,7 +224,7 @@ def test_interrupt_core_remove(cache_mode, filesystem):
|
||||
cache.set_cleaning_policy(CleaningPolicy.nop)
|
||||
|
||||
with TestRun.step(f"Add core device with {filesystem} filesystem and mount it"):
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core_part.create_filesystem(filesystem)
|
||||
core = cache.add_core(core_part)
|
||||
core.mount(mount_point)
|
||||
|
||||
@@ -343,7 +341,7 @@ def test_interrupt_cache_mode_switch_parametrized(cache_mode, stop_percentage):
|
||||
core = cache.add_core(core_part)
|
||||
|
||||
with TestRun.step(f"Create test file in mount point of exported object"):
|
||||
test_file = fs_utils.create_random_test_file(test_file_path, test_file_size)
|
||||
test_file = create_random_test_file(test_file_path, test_file_size)
|
||||
|
||||
with TestRun.step("Calculate md5sum of test file"):
|
||||
test_file_md5_before = test_file.md5sum()
|
||||
@@ -443,7 +441,7 @@ def test_interrupt_cache_stop(cache_mode, filesystem):
|
||||
cache.set_cleaning_policy(CleaningPolicy.nop)
|
||||
|
||||
with TestRun.step(f"Add core device with {filesystem} filesystem and mount it."):
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core_part.create_filesystem(filesystem)
|
||||
core = cache.add_core(core_part)
|
||||
core.mount(mount_point)
|
||||
|
||||
|
@@ -289,7 +289,7 @@ def test_one_core_fail_dirty():
|
||||
with TestRun.step("Check if core device is really out of cache."):
|
||||
output = str(casadm.list_caches().stdout.splitlines())
|
||||
if core_part1.path in output:
|
||||
TestRun.exception("The first core device should be unplugged!")
|
||||
TestRun.LOGGER.exception("The first core device should be unplugged!")
|
||||
|
||||
with TestRun.step("Verify that I/O to the remaining cores does not insert to cache"):
|
||||
dd_builder(cache_mode, core2, Size(100, Unit.MebiByte)).run()
|
||||
|
@@ -1,17 +1,18 @@
|
||||
#
|
||||
# Copyright(c) 2020-2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import pytest
|
||||
|
||||
import test_tools.udev
|
||||
from api.cas import casadm, casadm_parser, cli, cli_messages
|
||||
from api.cas.cache_config import CacheMode, CleaningPolicy, CacheModeTrait
|
||||
from test_tools.fs_tools import create_random_test_file
|
||||
from test_tools.udev import Udev
|
||||
from tests.lazy_writes.recovery.recovery_tests_methods import copy_file, compare_files
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools import fs_tools
|
||||
from type_def.size import Size, Unit
|
||||
|
||||
mount_point = "/mnt/cas"
|
||||
@@ -46,7 +47,7 @@ def test_stop_no_flush_load_cache(cache_mode):
|
||||
|
||||
with TestRun.step(f"Create test file in mount point of exported object and check its md5 sum."):
|
||||
test_file_size = Size(48, Unit.MebiByte)
|
||||
test_file = fs_utils.create_random_test_file(test_file_path, test_file_size)
|
||||
test_file = create_random_test_file(test_file_path, test_file_size)
|
||||
test_file_md5_before = test_file.md5sum()
|
||||
copy_file(source=test_file.full_path, target=core.path, size=test_file_size,
|
||||
direct="oflag")
|
||||
@@ -99,5 +100,5 @@ def prepare():
|
||||
core_dev = TestRun.disks['core']
|
||||
core_dev.create_partitions([Size(2, Unit.GibiByte)])
|
||||
core_part = core_dev.partitions[0]
|
||||
test_tools.udev.Udev.disable()
|
||||
Udev.disable()
|
||||
return cache_part, core_part
|
||||
|
@@ -6,12 +6,11 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import test_tools.fs_tools
|
||||
from api.cas import casadm, casadm_parser, cli, cli_messages
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from test_tools import fs_tools, disk_tools
|
||||
from test_tools.fs_tools import Filesystem
|
||||
from test_tools.disk_tools import get_block_size, create_partitions
|
||||
from test_tools.fs_tools import Filesystem, create_random_test_file, check_if_file_exists
|
||||
from test_utils.filesystem.file import File
|
||||
from test_utils.filesystem.symlink import Symlink
|
||||
from type_def.size import Size, Unit
|
||||
@@ -42,12 +41,12 @@ def test_load_cache_with_mounted_core():
|
||||
cache = casadm.start_cache(cache_part, force=True)
|
||||
|
||||
with TestRun.step("Add core device with xfs filesystem to cache and mount it."):
|
||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
||||
core_part.create_filesystem(Filesystem.xfs)
|
||||
core = cache.add_core(core_part)
|
||||
core.mount(mount_point)
|
||||
|
||||
with TestRun.step(f"Create test file in mount point of exported object and check its md5 sum."):
|
||||
test_file = fs_utils.create_random_test_file(test_file_path)
|
||||
test_file = create_random_test_file(test_file_path)
|
||||
test_file_md5_before = test_file.md5sum()
|
||||
|
||||
with TestRun.step("Unmount core device."):
|
||||
@@ -111,13 +110,13 @@ def test_stop_cache_with_mounted_partition():
|
||||
core2 = cache.add_core(core_dev2)
|
||||
|
||||
with TestRun.step("Create partitions on one exported object."):
|
||||
core.block_size = Size(disk_utils.get_block_size(core.get_device_id()))
|
||||
disk_utils.create_partitions(core, 2 * [Size(4, Unit.GibiByte)])
|
||||
core.block_size = Size(get_block_size(core.get_device_id()))
|
||||
create_partitions(core, 2 * [Size(4, Unit.GibiByte)])
|
||||
fs_part = core.partitions[0]
|
||||
|
||||
with TestRun.step("Create xfs filesystems on one exported object partition "
|
||||
"and on the non-partitioned exported object."):
|
||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
||||
fs_part.create_filesystem(Filesystem.xfs)
|
||||
core2.create_filesystem(Filesystem.xfs)
|
||||
|
||||
with TestRun.step("Mount created filesystems."):
|
||||
@@ -125,7 +124,7 @@ def test_stop_cache_with_mounted_partition():
|
||||
core2.mount(mount_point2)
|
||||
|
||||
with TestRun.step("Ensure /etc/mtab exists."):
|
||||
if not fs_utils.check_if_file_exists("/etc/mtab"):
|
||||
if not check_if_file_exists("/etc/mtab"):
|
||||
Symlink.create_symlink("/proc/self/mounts", "/etc/mtab")
|
||||
|
||||
with TestRun.step("Try to remove the core with partitions from cache."):
|
||||
@@ -181,12 +180,12 @@ def test_stop_cache_with_mounted_partition_no_mtab():
|
||||
cache = casadm.start_cache(cache_part, force=True)
|
||||
|
||||
with TestRun.step("Add core device with xfs filesystem and mount it."):
|
||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
||||
core_part.create_filesystem(Filesystem.xfs)
|
||||
core = cache.add_core(core_part)
|
||||
core.mount(mount_point)
|
||||
|
||||
with TestRun.step("Move /etc/mtab"):
|
||||
if fs_utils.check_if_file_exists("/etc/mtab"):
|
||||
if check_if_file_exists("/etc/mtab"):
|
||||
mtab = File("/etc/mtab")
|
||||
else:
|
||||
mtab = Symlink.create_symlink("/proc/self/mounts", "/etc/mtab")
|
||||
|
@@ -1,10 +1,10 @@
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import time
|
||||
|
||||
import pytest
|
||||
|
||||
from api.cas import casadm, cli, cli_messages
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
import pytest
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#
|
||||
# Copyright(c) 2019-2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
|
Reference in New Issue
Block a user