From 9c31e15d4843a4df5689319c878004f223262a33 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Wed, 20 Nov 2019 18:51:28 -0500 Subject: [PATCH 1/2] Override DUT's disks in conftest. Signed-off-by: Michal Mielewczyk --- test/functional/tests/conftest.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/functional/tests/conftest.py b/test/functional/tests/conftest.py index d94f781..2af4811 100644 --- a/test/functional/tests/conftest.py +++ b/test/functional/tests/conftest.py @@ -16,6 +16,7 @@ from api.cas import installer from api.cas import casadm from api.cas import git from test_utils.os_utils import Udev +from test_tools.disk_utils import PartitionTable, create_partition_table from log.logger import create_log, Log from test_utils.singleton import Singleton @@ -181,6 +182,11 @@ def base_prepare(item): except Exception: pass # TODO: Reboot DUT if test is executed remotely + for disk in TestRun.dut.disks: + disk.umount_all_partitions() + if not create_partition_table(disk, PartitionTable.gpt): + TestRun.exception(f"Failed to remove partitions from {disk}") + if get_force_param(item) and not TestRun.plugins['opencas'].already_updated: installer.reinstall_opencas() elif not installer.check_if_installed(): From be438dbe7cd8ef72d69a8bd75c326629ca4c5005 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Wed, 20 Nov 2019 22:07:32 -0500 Subject: [PATCH 2/2] Extend example dut config wih 'allow_disk_autoselect' option. By setting 'allow_disk_autoselect: True' user grants to framework permission to autodiscover and override DUT's disks. Signed-off-by: Michal Mielewczyk --- test/functional/config/example_dut_config.yml | 3 +++ test/functional/test-framework | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/functional/config/example_dut_config.yml b/test/functional/config/example_dut_config.yml index b595c9b..46f5c9d 100644 --- a/test/functional/config/example_dut_config.yml +++ b/test/functional/config/example_dut_config.yml @@ -8,6 +8,9 @@ type: "local" # env: "HTTPS_PROXY=myproxy.example:12345" +# By enabling this option framework is allowed to retrieve random non-os disks from DUT. +# It can lead to data loss!!! +allow_disk_autoselect: False working_dir: "/tmp/open-cas-linux/" disks: diff --git a/test/functional/test-framework b/test/functional/test-framework index 7c5c8fd..547fcaa 160000 --- a/test/functional/test-framework +++ b/test/functional/test-framework @@ -1 +1 @@ -Subproject commit 7c5c8fd5143497c56a8fb0cc1fe9a923f48a9db1 +Subproject commit 547fcaa5fb0cdc3ce5696785ce7d7ced81a85005