Disk tools and fs tools refactor

Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
This commit is contained in:
Katarzyna Treder
2024-12-11 18:58:26 +01:00
parent 940990e37a
commit f7e7d3aa7f
71 changed files with 197 additions and 172 deletions

View File

@@ -6,14 +6,15 @@
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_utils
from test_tools import fs_tools
from test_tools.dd import Dd
from test_tools.disk_utils import Filesystem
from test_tools.fs_tools import Filesystem
from test_tools.os_tools import DropCachesMode, sync, drop_caches
from test_tools.udev import Udev
from type_def.size import Size, Unit
@@ -54,7 +55,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."):
core_part.create_filesystem(filesystem)
test_tools.fs_utils.create_filesystem(filesystem)
core = cache.add_core(core_part)
core.mount(mount_point)
@@ -138,7 +139,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."):
core_part.create_filesystem(filesystem)
test_tools.fs_utils.create_filesystem(filesystem)
core = cache.add_core(core_part)
core.mount(mount_point)
@@ -225,7 +226,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"):
core_part.create_filesystem(filesystem)
test_tools.fs_utils.create_filesystem(filesystem)
core = cache.add_core(core_part)
core.mount(mount_point)
@@ -442,7 +443,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."):
core_part.create_filesystem(filesystem)
test_tools.fs_utils.create_filesystem(filesystem)
core = cache.add_core(core_part)
core.mount(mount_point)

View File

@@ -11,7 +11,7 @@ from api.cas.cache_config import CacheMode, CleaningPolicy, CacheModeTrait
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_utils
from test_tools import fs_tools
from type_def.size import Size, Unit
mount_point = "/mnt/cas"

View File

@@ -6,11 +6,12 @@
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_utils, disk_utils
from test_tools.disk_utils import Filesystem
from test_tools import fs_tools, disk_tools
from test_tools.fs_tools import Filesystem
from test_utils.filesystem.file import File
from test_utils.filesystem.symlink import Symlink
from type_def.size import Size, Unit
@@ -41,7 +42,7 @@ 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."):
core_part.create_filesystem(Filesystem.xfs)
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
core = cache.add_core(core_part)
core.mount(mount_point)
@@ -116,7 +117,7 @@ def test_stop_cache_with_mounted_partition():
with TestRun.step("Create xfs filesystems on one exported object partition "
"and on the non-partitioned exported object."):
fs_part.create_filesystem(Filesystem.xfs)
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
core2.create_filesystem(Filesystem.xfs)
with TestRun.step("Mount created filesystems."):
@@ -180,7 +181,7 @@ 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."):
core_part.create_filesystem(Filesystem.xfs)
test_tools.fs_utils.create_filesystem(Filesystem.xfs)
core = cache.add_core(core_part)
core.mount(mount_point)

View File

@@ -15,7 +15,7 @@ from type_def.size import Size, Unit
from api.cas.cache_config import CacheLineSize
from api.cas.cache import CacheStatus
from test_tools.dd import Dd
from test_tools.fs_utils import check_if_symlink_exists
from test_tools.fs_tools import check_if_symlink_exists
from test_tools.os_tools import sync