diff --git a/test/functional/.gitignore b/test/functional/.gitignore index ef4df32..10620a2 100644 --- a/test/functional/.gitignore +++ b/test/functional/.gitignore @@ -1,2 +1,3 @@ plugins/ results/ +config/dut_config.yml diff --git a/test/functional/tests/stress/test_stress_without_io.py b/test/functional/tests/stress/test_stress_without_io.py index b870b0a..33412c5 100644 --- a/test/functional/tests/stress/test_stress_without_io.py +++ b/test/functional/tests/stress/test_stress_without_io.py @@ -13,7 +13,6 @@ from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan from core.test_run import TestRun from test_tools import fs_utils from test_tools.disk_utils import Filesystem -from test_utils.filesystem.file import File from test_utils.size import Size, Unit iterations_per_config = 50 @@ -159,9 +158,8 @@ def test_stress_reload_cache(cache_mode): - CAS device loads successfully. - No data corruption. """ - with TestRun.step("Prepare cache and core. Create test file and count it's checksum."): - cache, core, md5_before_load, size_before_load, permissions_before_load = \ - prepare_with_file_creation(cache_mode) + with TestRun.step("Prepare cache and core. Create test file and count its checksum."): + cache, core, file, file_before = prepare_with_file_creation(cache_mode) for _ in TestRun.iteration(range(0, iterations_per_config), f"Stop and load cache {iterations_per_config} times."): @@ -180,7 +178,12 @@ def test_stress_reload_cache(cache_mode): TestRun.fail(f"Expected cores count: 1; Actual cores count: {cores_count}.") with TestRun.step("Check md5 of test file."): - check_files(core, size_before_load, permissions_before_load, md5_before_load) + core.mount(mount_point) + file_after = file.get_properties() + if file_after != file_before: + TestRun.LOGGER.error("File properties before and after are different.") + core.unmount() + with TestRun.step("Stop all caches."): casadm.stop_all_caches() @@ -197,9 +200,8 @@ def test_stress_add_remove_core(cache_mode): - Core is added and removed successfully. - No data corruption. """ - with TestRun.step("Prepare cache and core. Create test file and count it's checksum."): - cache, core, md5_before_load, size_before_load, permissions_before_load = \ - prepare_with_file_creation(cache_mode) + with TestRun.step("Prepare cache and core. Create test file and count its checksum."): + cache, core, file, file_before = prepare_with_file_creation(cache_mode) for _ in TestRun.iteration(range(0, iterations_per_config), f"Add and remove core {iterations_per_config} times."): @@ -221,7 +223,12 @@ def test_stress_add_remove_core(cache_mode): TestRun.fail(f"Expected cores count: 1; Actual cores count: {cores_count}.") with TestRun.step("Check md5 of test file."): - check_files(core, size_before_load, permissions_before_load, md5_before_load) + core.mount(mount_point) + file_after = file.get_properties() + if file_after != file_before: + TestRun.LOGGER.error("File properties before and after are different.") + core.unmount() + with TestRun.step("Stop all caches."): casadm.stop_all_caches() @@ -238,9 +245,9 @@ def test_stress_reload_module(cache_mode): - CAS modules reloads with no errors. - No data corruption. """ - with TestRun.step("Prepare cache and core. Create test file and count it's checksum."): - cache, core, md5_before_load, size_before_load, permissions_before_load = \ - prepare_with_file_creation(cache_mode) + with TestRun.step("Prepare cache and core. Create test file and count its checksum."): + cache, core, file, file_before = prepare_with_file_creation(cache_mode) + with TestRun.step("Save current cache configuration."): cache_config = cache.get_cache_config() @@ -270,47 +277,26 @@ def test_stress_reload_module(cache_mode): TestRun.fail("Cache configuration is different than before reloading modules.") with TestRun.step("Check md5 of test file."): - check_files(core, size_before_load, permissions_before_load, md5_before_load) + core.mount(mount_point) + file_after = file.get_properties() + if file_after != file_before: + TestRun.LOGGER.error("File properties before and after are different.") + core.unmount() + with TestRun.step("Stop all caches."): casadm.stop_all_caches() -def check_files(core, size_before, permissions_before, md5_before): - TestRun.LOGGER.info("Checking file md5.") - core.mount(mount_point) - file_after = fs_utils.parse_ls_output(fs_utils.ls(test_file_path))[0] - md5_after = file_after.md5sum() - if md5_before != md5_after: - TestRun.LOGGER.error(f"Md5 before ({md5_before}) and after ({md5_after}) are different.") - - if permissions_before.user == file_after.permissions.user: - TestRun.LOGGER.error(f"User permissions before ({permissions_before.user}) " - f"and after ({file_after.permissions.user}) are different.") - if permissions_before.group != file_after.permissions.group: - TestRun.LOGGER.error(f"Group permissions before ({permissions_before.group}) " - f"and after ({file_after.permissions.group}) are different.") - if permissions_before.other != file_after.permissions.other: - TestRun.LOGGER.error(f"Other permissions before ({permissions_before.other}) " - f"and after ({file_after.permissions.other}) are different.") - if size_before != file_after.size: - TestRun.LOGGER.error(f"Size before ({size_before}) and after ({file_after.size}) " - f"are different.") - core.unmount() - - def prepare_with_file_creation(config): cache_dev, core_dev = prepare() cache = casadm.start_cache(cache_dev, config, force=True) core = cache.add_core(core_dev) core.create_filesystem(Filesystem.ext3) core.mount(mount_point) - file = File.create_file(test_file_path) - file.write("Test content") - md5_before_load = file.md5sum() - size_before_load = file.size - permissions_before_load = file.permissions + file = fs_utils.create_test_file(test_file_path) + file_properties = file.get_properties() core.unmount() - return cache, core, md5_before_load, size_before_load, permissions_before_load + return cache, core, file, file_properties def prepare():