Skip to content

Commit

Permalink
Move validate_configuration method to LVM common
Browse files Browse the repository at this point in the history
Signed-off-by: Katarzyna Treder <[email protected]>
  • Loading branch information
Katarzyna Treder committed Nov 13, 2024
1 parent c142610 commit ef8843b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 48 deletions.
17 changes: 17 additions & 0 deletions test/functional/tests/volumes/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,20 @@ def get_test_configuration():
devices = get_block_device_names_list(exclude_list=[7]) # 7 stands for loop device

return config_output.stdout, devices

def validate_configuration(config_before_reboot, devices_before):
config_after_reboot, devices_after = get_test_configuration()

if config_after_reboot == config_before_reboot:
TestRun.LOGGER.info(f"Configuration is as expected")
else:
TestRun.LOGGER.info(f"config before reboot: {config_before_reboot}")
TestRun.LOGGER.info(f"config after reboot: {config_after_reboot}")
TestRun.LOGGER.error(f"Configuration changed after reboot")

if devices_after == devices_before:
TestRun.LOGGER.info(f"Device list is as expected")
else:
TestRun.LOGGER.info(f"Devices before: {devices_before}")
TestRun.LOGGER.info(f"Devices after: {devices_after}")
TestRun.LOGGER.error(f"Device list changed after reboot")
18 changes: 2 additions & 16 deletions test/functional/tests/volumes/test_many_cores_on_many_lvms.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from test_tools.fio.fio import Fio
from test_tools.fio.fio_param import ReadWrite, IoEngine, VerifyMethod
from test_utils.size import Size, Unit
from tests.volumes.common import get_test_configuration
from tests.volumes.common import get_test_configuration, validate_configuration


@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
Expand Down Expand Up @@ -81,21 +81,7 @@ def test_many_cores_on_many_lvms():
TestRun.executor.reboot()

with TestRun.step("Validate running configuration"):
config_after_reboot, devices_after = get_test_configuration()

if config_after_reboot == config_before_reboot:
TestRun.LOGGER.info(f"Configuration is as expected")
else:
TestRun.LOGGER.info(f"config before reboot: {config_before_reboot}")
TestRun.LOGGER.info(f"config after reboot: {config_after_reboot}")
TestRun.LOGGER.error(f"Configuration changed after reboot")

if devices_after == devices_before:
TestRun.LOGGER.info(f"Device list is as expected")
else:
TestRun.LOGGER.info(f"Devices before: {devices_before}")
TestRun.LOGGER.info(f"Devices after: {devices_after}")
TestRun.LOGGER.error(f"Device list changed after reboot")
validate_configuration(config_before_reboot, devices_before)

with TestRun.step("Run FIO with verification on LVM."):
fio_run.run()
Expand Down
18 changes: 2 additions & 16 deletions test/functional/tests/volumes/test_many_lvms_on_many_cores.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from test_tools.fio.fio import Fio
from test_tools.fio.fio_param import ReadWrite, IoEngine, VerifyMethod
from test_utils.size import Size, Unit
from tests.volumes.common import get_test_configuration, lvm_filters
from tests.volumes.common import get_test_configuration, lvm_filters, validate_configuration


@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
Expand Down Expand Up @@ -89,21 +89,7 @@ def test_many_lvms_on_many_cores():
TestRun.executor.reboot()

with TestRun.step("Validate running configuration"):
config_after_reboot, devices_after = get_test_configuration()

if config_after_reboot == config_before_reboot:
TestRun.LOGGER.info(f"Configuration is as expected")
else:
TestRun.LOGGER.info(f"config before reboot: {config_before_reboot}")
TestRun.LOGGER.info(f"config after reboot: {config_after_reboot}")
TestRun.LOGGER.error(f"Configuration changed after reboot")

if devices_after == devices_before:
TestRun.LOGGER.info(f"Device list is as expected")
else:
TestRun.LOGGER.info(f"Devices before: {devices_before}")
TestRun.LOGGER.info(f"Devices after: {devices_after}")
TestRun.LOGGER.error(f"Device list changed after reboot")
validate_configuration(config_before_reboot, devices_before)

with TestRun.step("Run FIO with verification on LVM."):
fio_run.run()
Expand Down
18 changes: 2 additions & 16 deletions test/functional/tests/volumes/test_many_lvms_on_single_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from test_tools.fio.fio import Fio
from test_tools.fio.fio_param import ReadWrite, IoEngine, VerifyMethod
from test_utils.size import Size, Unit
from tests.volumes.common import get_test_configuration, lvm_filters
from tests.volumes.common import get_test_configuration, lvm_filters, validate_configuration


@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
Expand Down Expand Up @@ -78,21 +78,7 @@ def test_many_lvms_on_single_core():
TestRun.executor.reboot()

with TestRun.step("Validate running configuration"):
config_after_reboot, devices_after = get_test_configuration()

if config_after_reboot == config_before_reboot:
TestRun.LOGGER.info(f"Configuration is as expected")
else:
TestRun.LOGGER.info(f"config before reboot: {config_before_reboot}")
TestRun.LOGGER.info(f"config after reboot: {config_after_reboot}")
TestRun.LOGGER.error(f"Configuration changed after reboot")

if devices_after == devices_before:
TestRun.LOGGER.info(f"Device list is as expected")
else:
TestRun.LOGGER.info(f"Devices before: {devices_before}")
TestRun.LOGGER.info(f"Devices after: {devices_after}")
TestRun.LOGGER.error(f"Device list changed after reboot")
validate_configuration(config_before_reboot, devices_before)

with TestRun.step("Run FIO with verification on LVM."):
fio_run.run()
Expand Down

0 comments on commit ef8843b

Please sign in to comment.