From a16576dbdcd7cc3ca060ef581bb264dd239a960f Mon Sep 17 00:00:00 2001 From: Vladimir Avdeev Date: Thu, 14 Jul 2022 10:20:39 +0300 Subject: [PATCH] Added more allure logs for failovers --- .../failovers/test_failover_storage.py | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/pytest_tests/testsuites/failovers/test_failover_storage.py b/pytest_tests/testsuites/failovers/test_failover_storage.py index 121c349f..594dd66a 100644 --- a/pytest_tests/testsuites/failovers/test_failover_storage.py +++ b/pytest_tests/testsuites/failovers/test_failover_storage.py @@ -20,7 +20,7 @@ stopped_hosts = [] @pytest.fixture(scope='session') def free_storage_check(): if os.getenv('FREE_STORAGE', default='False').lower() not in ('true', '1'): - pytest.skip('Test work only on SberCloud infrastructure') + pytest.skip('Test only works on SberCloud infrastructure') yield @@ -31,7 +31,6 @@ def sbercloud_client(): yield SberCloud(f'{os.getcwd()}/configuration/sbercloud.yaml') except Exception: pytest.fail('SberCloud infrastructure not available') - yield None @pytest.fixture(scope='session', autouse=True) @@ -40,7 +39,6 @@ def return_all_storage_nodes_fixture(sbercloud_client): return_all_storage_nodes(sbercloud_client) -@allure.title('Hard reboot host via magic SysRq option') def panic_reboot_host(ip: str = None): ssh = HostClient(ip=ip, init_ssh_client=False) ssh.pk = SSH_PK_PATH @@ -108,15 +106,19 @@ def test_panic_storage_node(prepare_wallet_and_deposit, free_storage_check, sequ cid = create_container(wallet, rule=placement_rule, basic_acl=PUBLIC_ACL) oid = put_object(wallet, source_file_path, cid) - with allure.step(f'Return storage nodes'): - nodes = wait_object_replication(wallet, cid, oid, 2) - for node in nodes: + nodes = wait_object_replication(wallet, cid, oid, 2) + allure.attach.file('\n'.join(nodes), 'Current nodes with object', allure.attachment_type.TEXT) + for node in nodes: + with allure.step(f'Hard reboot host {node} via magic SysRq option'): panic_reboot_host(ip=node.split(':')[-2]) if sequence: - wait_object_replication(wallet, cid, oid, 2) + new_nodes = wait_object_replication(wallet, cid, oid, 2) + allure.attach.file('\n'.join(new_nodes), f'Nodes with object after {node} fail', + allure.attachment_type.TEXT) - if not sequence: - wait_object_replication(wallet, cid, oid, 2) + if not sequence: + new_nodes = wait_object_replication(wallet, cid, oid, 2) + allure.attach.file('\n'.join(new_nodes), 'Nodes with object after nodes fail', allure.attachment_type.TEXT) - got_file_path = get_object(wallet, cid, oid) - assert get_file_hash(source_file_path) == get_file_hash(got_file_path) + got_file_path = get_object(wallet, cid, oid) + assert get_file_hash(source_file_path) == get_file_hash(got_file_path)