Added more allure logs for failovers

This commit is contained in:
Vladimir Avdeev 2022-07-14 10:20:39 +03:00 committed by Vladimir Domnich
parent 378456e6d4
commit a16576dbdc

View file

@ -20,7 +20,7 @@ stopped_hosts = []
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def free_storage_check(): def free_storage_check():
if os.getenv('FREE_STORAGE', default='False').lower() not in ('true', '1'): 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 yield
@ -31,7 +31,6 @@ def sbercloud_client():
yield SberCloud(f'{os.getcwd()}/configuration/sbercloud.yaml') yield SberCloud(f'{os.getcwd()}/configuration/sbercloud.yaml')
except Exception: except Exception:
pytest.fail('SberCloud infrastructure not available') pytest.fail('SberCloud infrastructure not available')
yield None
@pytest.fixture(scope='session', autouse=True) @pytest.fixture(scope='session', autouse=True)
@ -40,7 +39,6 @@ def return_all_storage_nodes_fixture(sbercloud_client):
return_all_storage_nodes(sbercloud_client) return_all_storage_nodes(sbercloud_client)
@allure.title('Hard reboot host via magic SysRq option')
def panic_reboot_host(ip: str = None): def panic_reboot_host(ip: str = None):
ssh = HostClient(ip=ip, init_ssh_client=False) ssh = HostClient(ip=ip, init_ssh_client=False)
ssh.pk = SSH_PK_PATH 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) cid = create_container(wallet, rule=placement_rule, basic_acl=PUBLIC_ACL)
oid = put_object(wallet, source_file_path, cid) oid = put_object(wallet, source_file_path, cid)
with allure.step(f'Return storage nodes'): nodes = wait_object_replication(wallet, cid, oid, 2)
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: for node in nodes:
with allure.step(f'Hard reboot host {node} via magic SysRq option'):
panic_reboot_host(ip=node.split(':')[-2]) panic_reboot_host(ip=node.split(':')[-2])
if sequence: 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: if not sequence:
wait_object_replication(wallet, cid, oid, 2) 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) got_file_path = get_object(wallet, cid, oid)
assert get_file_hash(source_file_path) == get_file_hash(got_file_path) assert get_file_hash(source_file_path) == get_file_hash(got_file_path)