Add fixture to collect logs after test execution
Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
This commit is contained in:
parent
6d040c6834
commit
94d6ec6b12
2 changed files with 66 additions and 1 deletions
|
@ -2,6 +2,7 @@ import logging
|
|||
import os
|
||||
import re
|
||||
import shutil
|
||||
from datetime import datetime
|
||||
|
||||
import allure
|
||||
import pytest
|
||||
|
@ -62,9 +63,22 @@ def _get_binaries_version_local(binaries: list) -> dict:
|
|||
return env_out
|
||||
|
||||
|
||||
@pytest.fixture(scope='session', autouse=True)
|
||||
@allure.title('Collect logs')
|
||||
def collect_logs():
|
||||
start_time = datetime.utcnow()
|
||||
yield
|
||||
end_time = datetime.utcnow()
|
||||
|
||||
helper = get_storage_service_helper()
|
||||
logs_by_service_id = helper.logs(since=start_time, until=end_time)
|
||||
for service_id, logs in logs_by_service_id.items():
|
||||
allure.attach(logs, f"logs_{service_id}", allure.attachment_type.TEXT)
|
||||
|
||||
|
||||
@pytest.fixture(scope='session', autouse=True)
|
||||
@allure.title('Run health check for all storage nodes')
|
||||
def run_health_check():
|
||||
def run_health_check(collect_logs):
|
||||
failed_nodes = []
|
||||
for node_name in NEOFS_NETMAP_DICT.keys():
|
||||
health_check = node_healthcheck(node_name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue