tests: reformat test_clean_reboot

Signed-off-by: Kamil Gierszewski <kamil.gierszewski@huawei.com>
This commit is contained in:
Kamil Gierszewski 2024-09-25 19:22:06 +02:00
parent 41460f0e6c
commit 61ff8f60c5
No known key found for this signature in database

View File

@ -1,5 +1,6 @@
#
# Copyright(c) 2020-2022 Intel Corporation
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#
@ -29,17 +30,17 @@ mount_point = "/mnt/test"
@pytest.mark.require_plugin("power_control")
def test_load_after_clean_shutdown(reboot_type, cache_mode, filesystem):
"""
title: Planned system shutdown test.
description: Test for data consistency after clean system shutdown.
pass_criteria:
- DUT should reboot successfully.
- Checksum of file on core device should be the same before and after reboot.
title: Planned system shutdown test.
description: Test for data consistency after clean system shutdown.
pass_criteria:
- DUT should reboot successfully.
- Checksum of file on core device should be the same before and after reboot.
"""
with TestRun.step("Prepare CAS device."):
cache_disk = TestRun.disks['cache']
cache_disk = TestRun.disks["cache"]
cache_disk.create_partitions([Size(1, Unit.GibiByte)])
cache_dev = cache_disk.partitions[0]
core_dev = TestRun.disks['core']
core_dev = TestRun.disks["core"]
cache = casadm.start_cache(cache_dev, cache_mode, force=True)
core = cache.add_core(core_dev)
core.create_filesystem(filesystem, blocksize=int(Size(1, Unit.Blocks4096)))
@ -47,12 +48,9 @@ def test_load_after_clean_shutdown(reboot_type, cache_mode, filesystem):
with TestRun.step("Create file on cache and count its checksum."):
test_file = File(os.path.join(mount_point, "test_file"))
Dd()\
.input("/dev/zero")\
.output(test_file.full_path)\
.block_size(Size(1, Unit.KibiByte))\
.count(1024)\
.run()
Dd().input("/dev/zero").output(test_file.full_path).block_size(
Size(1, Unit.KibiByte)
).count(1024).run()
test_file.refresh_item()
test_file_md5 = test_file.md5sum()
sync()
@ -62,7 +60,7 @@ def test_load_after_clean_shutdown(reboot_type, cache_mode, filesystem):
if reboot_type == "soft":
TestRun.executor.reboot()
else:
power_control = TestRun.plugin_manager.get_plugin('power_control')
power_control = TestRun.plugin_manager.get_plugin("power_control")
power_control.power_cycle()
with TestRun.step("Load cache."):