tests: reformat test_clean_reboot
Signed-off-by: Kamil Gierszewski <kamil.gierszewski@huawei.com>
This commit is contained in:
parent
41460f0e6c
commit
61ff8f60c5
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2022 Intel Corporation
|
# Copyright(c) 2020-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -29,17 +30,17 @@ mount_point = "/mnt/test"
|
|||||||
@pytest.mark.require_plugin("power_control")
|
@pytest.mark.require_plugin("power_control")
|
||||||
def test_load_after_clean_shutdown(reboot_type, cache_mode, filesystem):
|
def test_load_after_clean_shutdown(reboot_type, cache_mode, filesystem):
|
||||||
"""
|
"""
|
||||||
title: Planned system shutdown test.
|
title: Planned system shutdown test.
|
||||||
description: Test for data consistency after clean system shutdown.
|
description: Test for data consistency after clean system shutdown.
|
||||||
pass_criteria:
|
pass_criteria:
|
||||||
- DUT should reboot successfully.
|
- DUT should reboot successfully.
|
||||||
- Checksum of file on core device should be the same before and after reboot.
|
- Checksum of file on core device should be the same before and after reboot.
|
||||||
"""
|
"""
|
||||||
with TestRun.step("Prepare CAS device."):
|
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_disk.create_partitions([Size(1, Unit.GibiByte)])
|
||||||
cache_dev = cache_disk.partitions[0]
|
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)
|
cache = casadm.start_cache(cache_dev, cache_mode, force=True)
|
||||||
core = cache.add_core(core_dev)
|
core = cache.add_core(core_dev)
|
||||||
core.create_filesystem(filesystem, blocksize=int(Size(1, Unit.Blocks4096)))
|
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."):
|
with TestRun.step("Create file on cache and count its checksum."):
|
||||||
test_file = File(os.path.join(mount_point, "test_file"))
|
test_file = File(os.path.join(mount_point, "test_file"))
|
||||||
Dd()\
|
Dd().input("/dev/zero").output(test_file.full_path).block_size(
|
||||||
.input("/dev/zero")\
|
Size(1, Unit.KibiByte)
|
||||||
.output(test_file.full_path)\
|
).count(1024).run()
|
||||||
.block_size(Size(1, Unit.KibiByte))\
|
|
||||||
.count(1024)\
|
|
||||||
.run()
|
|
||||||
test_file.refresh_item()
|
test_file.refresh_item()
|
||||||
test_file_md5 = test_file.md5sum()
|
test_file_md5 = test_file.md5sum()
|
||||||
sync()
|
sync()
|
||||||
@ -62,7 +60,7 @@ def test_load_after_clean_shutdown(reboot_type, cache_mode, filesystem):
|
|||||||
if reboot_type == "soft":
|
if reboot_type == "soft":
|
||||||
TestRun.executor.reboot()
|
TestRun.executor.reboot()
|
||||||
else:
|
else:
|
||||||
power_control = TestRun.plugin_manager.get_plugin('power_control')
|
power_control = TestRun.plugin_manager.get_plugin("power_control")
|
||||||
power_control.power_cycle()
|
power_control.power_cycle()
|
||||||
|
|
||||||
with TestRun.step("Load cache."):
|
with TestRun.step("Load cache."):
|
||||||
|
Loading…
Reference in New Issue
Block a user