Fix imports
Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
#
|
||||
|
||||
from api.cas.init_config import InitConfig, opencas_conf_path
|
||||
from test_tools import fs_tools
|
||||
from core.test_run import TestRun
|
||||
from test_tools.disk_tools import get_block_device_names_list
|
||||
from test_tools.fs_tools import create_random_test_file, parse_ls_output, ls_item
|
||||
from type_def.size import Size, Unit
|
||||
|
||||
test_file_size = Size(500, Unit.KiloByte)
|
||||
@@ -23,7 +23,7 @@ def create_files_with_md5sums(destination_path, files_count):
|
||||
temp_file = f"/tmp/file{i}"
|
||||
destination_file = f"{destination_path}/file{i}"
|
||||
|
||||
test_file = fs_utils.create_random_test_file(temp_file, test_file_size)
|
||||
test_file = create_random_test_file(temp_file, test_file_size)
|
||||
test_file.copy(destination_file, force=True)
|
||||
|
||||
md5sums.append(test_file.md5sum())
|
||||
@@ -37,12 +37,12 @@ def compare_md5sums(md5_sums_source, files_to_check_path, copy_to_tmp=False):
|
||||
|
||||
for i in range(md5_sums_elements):
|
||||
file_to_check_path = f"{files_to_check_path}/file{i}"
|
||||
file_to_check = fs_utils.parse_ls_output(fs_utils.ls_item(file_to_check_path))[0]
|
||||
file_to_check = parse_ls_output(ls_item(file_to_check_path))[0]
|
||||
|
||||
if copy_to_tmp:
|
||||
file_to_check_path = f"{files_to_check_path}/filetmp"
|
||||
file_to_check.copy(file_to_check_path, force=True)
|
||||
file_to_check = fs_utils.parse_ls_output(fs_utils.ls_item(file_to_check_path))[0]
|
||||
file_to_check = parse_ls_output(ls_item(file_to_check_path))[0]
|
||||
|
||||
if md5_sums_source[i] != file_to_check.md5sum():
|
||||
TestRun.fail(f"Source and target files {file_to_check_path} checksums are different.")
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#
|
||||
# Copyright(c) 2020-2021 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
|
@@ -1,10 +1,11 @@
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
|
||||
import pytest
|
||||
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from core.test_run import TestRun
|
||||
from api.cas.cache import CacheMode, casadm
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#
|
||||
# Copyright(c) 2020-2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
@@ -11,8 +12,7 @@ from .common import compare_md5sums, create_files_with_md5sums
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from storage_devices.raid import Raid, RaidConfiguration, MetadataVariant, Level
|
||||
from test_tools import fs_tools
|
||||
from test_tools.fs_tools import Filesystem
|
||||
from test_tools.fs_tools import Filesystem, create_random_test_file, remove
|
||||
from type_def.size import Size, Unit
|
||||
|
||||
mount_point = "/mnt/test"
|
||||
@@ -66,14 +66,14 @@ def test_raid_as_cache(cache_mode):
|
||||
|
||||
with TestRun.step("Copy files to cache and check md5sum."):
|
||||
for i in range(0, number_of_files):
|
||||
test_file = fs_utils.create_random_test_file(test_file_tmp_path, test_file_size)
|
||||
test_file = create_random_test_file(test_file_tmp_path, test_file_size)
|
||||
test_file_copied = test_file.copy(test_file_path, force=True)
|
||||
|
||||
if test_file.md5sum() != test_file_copied.md5sum():
|
||||
TestRun.LOGGER.error("Checksums are different.")
|
||||
|
||||
fs_utils.remove(test_file.full_path, True)
|
||||
fs_utils.remove(test_file_copied.full_path, True)
|
||||
remove(test_file.full_path, True)
|
||||
remove(test_file_copied.full_path, True)
|
||||
|
||||
TestRun.LOGGER.info(f"Successful verification.")
|
||||
|
||||
|
@@ -1,19 +1,18 @@
|
||||
#
|
||||
# Copyright(c) 2020-2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import pytest
|
||||
|
||||
import test_tools.fs_tools
|
||||
from api.cas import casadm
|
||||
from api.cas.cache_config import CacheMode
|
||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.partition import Partition
|
||||
from test_tools import fs_tools, disk_tools
|
||||
from test_tools.disk_tools import PartitionTable
|
||||
from test_tools.fs_tools import Filesystem
|
||||
from test_tools.disk_tools import PartitionTable, create_partitions
|
||||
from test_tools.fs_tools import Filesystem, create_random_test_file
|
||||
from type_def.size import Size, Unit
|
||||
|
||||
mount_point = "/mnt/cas"
|
||||
@@ -44,8 +43,8 @@ def test_cas_preserves_partitions(partition_table, filesystem, cache_mode):
|
||||
core_dev.create_partitions(core_sizes, partition_table)
|
||||
|
||||
with TestRun.step("Create filesystem on core devices."):
|
||||
for i in range(cores_number):
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
for part in core_dev.partitions:
|
||||
part.create_filesystem(filesystem)
|
||||
|
||||
with TestRun.step("Mount core devices and create test files."):
|
||||
files = []
|
||||
@@ -53,7 +52,7 @@ def test_cas_preserves_partitions(partition_table, filesystem, cache_mode):
|
||||
mount_path = f"{mount_point}{i}"
|
||||
core.mount(mount_path)
|
||||
test_file_path = f"{mount_path}/test_file"
|
||||
files.append(fs_utils.create_random_test_file(test_file_path))
|
||||
files.append(create_random_test_file(test_file_path))
|
||||
|
||||
with TestRun.step("Check md5 sums of test files."):
|
||||
test_files_md5sums = []
|
||||
@@ -122,11 +121,11 @@ def test_partition_create_cas(partition_table, filesystem, cache_mode):
|
||||
with TestRun.step("Create partitions on exported device."):
|
||||
core_sizes = [Size(1, Unit.GibiByte)] * cores_number
|
||||
core.block_size = core_dev.block_size
|
||||
disk_utils.create_partitions(core, core_sizes, partition_table)
|
||||
create_partitions(core, core_sizes, partition_table)
|
||||
|
||||
with TestRun.step("Create filesystem on core devices."):
|
||||
for part in core.partitions:
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
part.create_filesystem(filesystem)
|
||||
|
||||
with TestRun.step("Mount core devices and create test files."):
|
||||
files = []
|
||||
@@ -134,7 +133,7 @@ def test_partition_create_cas(partition_table, filesystem, cache_mode):
|
||||
mount_path = f"{mount_point}{i}"
|
||||
part.mount(mount_path)
|
||||
test_file_path = f"{mount_path}/test_file"
|
||||
files.append(fs_utils.create_random_test_file(test_file_path))
|
||||
files.append(create_random_test_file(test_file_path))
|
||||
|
||||
with TestRun.step("Check md5 sums of test files."):
|
||||
test_files_md5sums = []
|
||||
|
Reference in New Issue
Block a user