Fix imports
Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
This commit is contained in:
@@ -6,11 +6,11 @@
|
||||
|
||||
import random
|
||||
import time
|
||||
import pytest
|
||||
|
||||
from collections import namedtuple
|
||||
from datetime import timedelta
|
||||
|
||||
import pytest
|
||||
|
||||
from api.cas import casadm
|
||||
from api.cas.cache_config import (
|
||||
CacheMode,
|
||||
|
@@ -1,13 +1,14 @@
|
||||
#
|
||||
# Copyright(c) 2020-2021 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import time
|
||||
from datetime import timedelta
|
||||
|
||||
import pytest
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
from api.cas import casadm
|
||||
from api.cas.cache_config import CacheMode, CleaningPolicy, FlushParametersAlru, SeqCutOffPolicy
|
||||
from core.test_run import TestRun
|
||||
|
@@ -1,10 +1,10 @@
|
||||
#
|
||||
# Copyright(c) 2019-2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import time
|
||||
|
||||
import pytest
|
||||
|
||||
from api.cas import casadm
|
||||
|
@@ -1,12 +1,14 @@
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import pytest
|
||||
|
||||
from datetime import timedelta
|
||||
from time import sleep
|
||||
|
||||
import pytest
|
||||
from api.cas import casadm
|
||||
from api.cas.cache_config import CacheMode, CleaningPolicy
|
||||
from core.test_run_utils import TestRun
|
||||
|
@@ -1,20 +1,21 @@
|
||||
#
|
||||
# Copyright(c) 2020-2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
import test_tools.common.wait
|
||||
from test_tools.common.wait import wait
|
||||
from core.test_run import TestRun
|
||||
from test_tools import fs_tools
|
||||
from test_tools.dd import Dd
|
||||
from test_tools.fs_tools import create_random_test_file
|
||||
from test_utils.filesystem.file import File
|
||||
from type_def.size import Size, Unit
|
||||
|
||||
|
||||
def create_test_files(test_file_size):
|
||||
source_file = fs_utils.create_random_test_file("/tmp/source_test_file", test_file_size)
|
||||
source_file = create_random_test_file("/tmp/source_test_file", test_file_size)
|
||||
target_file = File.create_file("/tmp/target_test_file")
|
||||
return source_file, target_file
|
||||
|
||||
@@ -47,8 +48,10 @@ def power_cycle_dut(wait_for_flush_begin=False, core_device=None):
|
||||
raise Exception("Core device is None.")
|
||||
TestRun.LOGGER.info("Waiting for flushing to begin...")
|
||||
core_writes_before = core_device.get_io_stats().sectors_written
|
||||
test_tools.common.wait.wait(lambda: core_writes_before < core_device.get_io_stats().sectors_written,
|
||||
timedelta(minutes=3),
|
||||
timedelta(milliseconds=100))
|
||||
wait(
|
||||
lambda: core_writes_before < core_device.get_io_stats().sectors_written,
|
||||
timedelta(minutes=3),
|
||||
timedelta(milliseconds=100)
|
||||
)
|
||||
power_control = TestRun.plugin_manager.get_plugin('power_control')
|
||||
power_control.power_cycle()
|
||||
|
@@ -1,13 +1,12 @@
|
||||
#
|
||||
# Copyright(c) 2019-2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
import test_tools.fs_tools
|
||||
from api.cas import casadm
|
||||
from api.cas.cache_config import CacheMode, CacheModeTrait, CacheLineSize, CleaningPolicy, \
|
||||
FlushParametersAcp
|
||||
@@ -58,7 +57,7 @@ def test_recovery_all_options(cache_mode, cache_line_size, cleaning_policy, file
|
||||
file_md5 = test_file.md5sum()
|
||||
|
||||
with TestRun.step(f"Make {filesystem} on core device."):
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core_device.create_filesystem(filesystem)
|
||||
|
||||
with TestRun.step("Mount core device."):
|
||||
core_device.mount(mount_point)
|
||||
|
@@ -1,13 +1,12 @@
|
||||
#
|
||||
# Copyright(c) 2019-2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
import test_tools.fs_tools
|
||||
from api.cas import casadm, cli
|
||||
from api.cas.cache_config import CacheMode, CacheModeTrait, CleaningPolicy, SeqCutOffPolicy
|
||||
from core.test_run import TestRun
|
||||
@@ -125,8 +124,8 @@ def test_recovery_flush_reset_fs(cache_mode, fs):
|
||||
cache_device = cache_disk.partitions[0]
|
||||
core_device = core_disk.partitions[0]
|
||||
|
||||
with TestRun.step(f"Create {fs} filesystem on core."):
|
||||
test_tools.fs_utils.create_filesystem(fs)
|
||||
with TestRun.step(f"Create {fs} filesystem on core device."):
|
||||
core_device.create_filesystem(fs)
|
||||
|
||||
with TestRun.step("Create test files."):
|
||||
source_file, target_file = create_test_files(test_file_size)
|
||||
@@ -151,7 +150,7 @@ def test_recovery_flush_reset_fs(cache_mode, fs):
|
||||
core.unmount()
|
||||
|
||||
with TestRun.step("Trigger flush."):
|
||||
os_utils.drop_caches(DropCachesMode.ALL)
|
||||
drop_caches(DropCachesMode.ALL)
|
||||
TestRun.executor.run_in_background(cli.flush_cache_cmd(f"{cache.cache_id}"))
|
||||
|
||||
with TestRun.step("Hard reset DUT during data flushing."):
|
||||
|
@@ -5,10 +5,8 @@
|
||||
#
|
||||
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
import test_tools.fs_tools
|
||||
from api.cas import casadm, cli_messages
|
||||
from api.cas.cache_config import CacheMode, CacheModeTrait, CacheLineSize
|
||||
from core.test_run import TestRun
|
||||
@@ -54,7 +52,7 @@ def test_recovery_unplug_cache_fs(cache_mode, cls, filesystem, direct):
|
||||
source_file_md5 = source_file.md5sum()
|
||||
|
||||
with TestRun.step("Create filesystem on core device."):
|
||||
test_tools.fs_utils.create_filesystem(filesystem)
|
||||
core_device.create_filesystem(filesystem)
|
||||
|
||||
with TestRun.step("Start cache and add core."):
|
||||
cache = casadm.start_cache(cache_device, cache_mode, cls)
|
||||
|
@@ -1,9 +1,11 @@
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import pytest
|
||||
|
||||
from api.cas import casadm, casadm_parser
|
||||
from api.cas.cache_config import CacheMode, CleaningPolicy
|
||||
from core.test_run_utils import TestRun
|
||||
|
@@ -1,9 +1,11 @@
|
||||
#
|
||||
# Copyright(c) 2021 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import pytest
|
||||
|
||||
from api.cas import casadm, casadm_parser
|
||||
from api.cas.cache_config import CacheMode, CleaningPolicy
|
||||
from core.test_run_utils import TestRun
|
||||
|
@@ -5,9 +5,9 @@
|
||||
#
|
||||
|
||||
import pytest
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
import test_tools.fs_tools
|
||||
from api.cas import casadm
|
||||
from api.cas.cache_config import CacheMode, CacheModeTrait, CleaningPolicy, SeqCutOffPolicy
|
||||
from api.cas.cli import stop_cmd
|
||||
@@ -56,7 +56,7 @@ def test_flush_over_640_gibibytes_with_fs(cache_mode, fs):
|
||||
cache = casadm.start_cache(cache_part, cache_mode)
|
||||
|
||||
with TestRun.step(f"Add core with {fs.name} filesystem to cache and mount it."):
|
||||
test_tools.fs_utils.create_filesystem(fs)
|
||||
core_dev.create_filesystem(fs)
|
||||
core = cache.add_core(core_dev)
|
||||
core.mount(mnt_point)
|
||||
|
||||
@@ -66,7 +66,7 @@ def test_flush_over_640_gibibytes_with_fs(cache_mode, fs):
|
||||
|
||||
with TestRun.step("Create a test file on a separate disk"):
|
||||
src_dir_path = "/mnt/flush_640G_test"
|
||||
test_tools.fs_utils.create_filesystem(fs)
|
||||
separate_dev.create_filesystem(fs)
|
||||
separate_dev.mount(src_dir_path)
|
||||
|
||||
test_file_main = File.create_file(f"{src_dir_path}/test_file_main")
|
||||
|
@@ -1,11 +1,11 @@
|
||||
#
|
||||
# Copyright(c) 2020-2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies
|
||||
# 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, CleaningPolicy, CacheModeTrait, SeqCutOffPolicy
|
||||
from storage_devices.device import Device
|
||||
@@ -180,7 +180,7 @@ def test_clean_remove_core_with_fs(cache_mode, fs):
|
||||
cache = casadm.start_cache(cache_part, cache_mode)
|
||||
|
||||
with TestRun.step(f"Add core with {fs.name} filesystem to cache and mount it."):
|
||||
test_tools.fs_utils.create_filesystem(fs)
|
||||
core_part.create_filesystem(fs)
|
||||
core = cache.add_core(core_part)
|
||||
core.mount(mnt_point)
|
||||
|
||||
|
@@ -1,12 +1,13 @@
|
||||
#
|
||||
# Copyright(c) 2020-2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import pytest
|
||||
|
||||
from time import sleep
|
||||
|
||||
import test_tools.fs_tools
|
||||
from api.cas import casadm
|
||||
from api.cas.cache_config import (CacheMode,
|
||||
CacheModeTrait,
|
||||
@@ -47,7 +48,7 @@ def test_flush_signal_core(cache_mode):
|
||||
|
||||
with TestRun.step("Start cache and add SCSI device with xfs filesystem as core."):
|
||||
cache = casadm.start_cache(cache_part, cache_mode)
|
||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
||||
core_dev.create_filesystem(Filesystem.xfs)
|
||||
core = cache.add_core(core_dev)
|
||||
|
||||
with TestRun.step("Mount exported object."):
|
||||
@@ -145,7 +146,7 @@ def test_flush_signal_cache(cache_mode):
|
||||
|
||||
with TestRun.step("Start SCSI device as cache and add core with xfs filesystem."):
|
||||
cache = casadm.start_cache(cache_dev, cache_mode)
|
||||
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
|
||||
core_part.create_filesystem(Filesystem.xfs)
|
||||
core = cache.add_core(core_part)
|
||||
|
||||
with TestRun.step("Mount exported object."):
|
||||
|
@@ -4,9 +4,10 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import pytest
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
import pytest
|
||||
from api.cas import casadm, cli
|
||||
from api.cas.cache_config import CacheMode, CleaningPolicy, SeqCutOffPolicy
|
||||
from api.cas.casadm_parser import get_flushing_progress, wait_for_flushing
|
||||
|
@@ -1,9 +1,11 @@
|
||||
#
|
||||
# Copyright(c) 2020-2021 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import pytest
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
from type_def.size import Size, Unit
|
||||
@@ -40,8 +42,8 @@ def test_wb_throttling():
|
||||
description: |
|
||||
Fill cache with data, run intensive IO (rwmix=74) with occasional trims.
|
||||
pass_criteria:
|
||||
- Hang task did not occurred
|
||||
- System did not crashed
|
||||
- Hang task did not occur
|
||||
- System did not crash
|
||||
"""
|
||||
with TestRun.step("Prepare devices."):
|
||||
cache_device = TestRun.disks["cache"]
|
||||
|
Reference in New Issue
Block a user