Skip to content

Commit 95f3cb4

Browse files
authored
do not get logs from succcess requests (#12934)
1 parent 20b281b commit 95f3cb4

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

ydb/tests/olap/load/lib/conftest.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import json
55
import yatest
66
import os
7+
import logging
78
from allure_commons._core import plugin_manager
89
from allure_pytest.listener import AllureListener
910
from copy import deepcopy
@@ -110,9 +111,15 @@ def _attach_logs(cls, start_time, attach_name):
110111
ssh_cmd += ['-i', ssh_key_file]
111112
for host in hosts:
112113
for c in exec_kikimr.keys():
113-
exec_kikimr[c][host] = yatest.common.execute(ssh_cmd + [host, cmd.format(storage='kikimr', container=c)], wait=False)
114+
try:
115+
exec_kikimr[c][host] = yatest.common.execute(ssh_cmd + [host, cmd.format(storage='kikimr', container=c)], wait=False)
116+
except BaseException as e:
117+
logging.error(e)
114118
for c in exec_start.keys():
115-
exec_start[c][host] = yatest.common.execute(ssh_cmd + [host, cmd.format(storage='kikimr-start', container=c)], wait=False)
119+
try:
120+
exec_start[c][host] = yatest.common.execute(ssh_cmd + [host, cmd.format(storage='kikimr-start', container=c)], wait=False)
121+
except BaseException as e:
122+
logging.error(e)
116123

117124
error_log = ''
118125
for c, execs in exec_start.items():
@@ -200,8 +207,6 @@ def _attach_plans(plan: YdbCliHelper.QueryPlan) -> None:
200207
for p in ['Mean']:
201208
if p in stats:
202209
allure.dynamic.parameter(p, _duration_text(stats[p] / 1000.))
203-
if os.getenv('NO_KUBER_LOGS') is None:
204-
cls._attach_logs(start_time=result.start_time, attach_name='kikimr')
205210
error_message = ''
206211
success = True
207212
if not result.success:
@@ -210,6 +215,8 @@ def _attach_plans(plan: YdbCliHelper.QueryPlan) -> None:
210215
elif stats.get('FailsCount', 0) != 0:
211216
success = False
212217
error_message = 'There are fail attemps'
218+
if os.getenv('NO_KUBER_LOGS') is None and not success:
219+
cls._attach_logs(start_time=result.start_time, attach_name='kikimr')
213220
if upload:
214221
ResultsProcessor.upload_results(
215222
kind='Load',
@@ -250,7 +257,7 @@ def setup_class(cls) -> None:
250257
timestamp=start_time,
251258
is_successful=(error is None)
252259
)
253-
if os.getenv('NO_KUBER_LOGS') is None:
260+
if os.getenv('NO_KUBER_LOGS') is None and error is not None:
254261
cls._attach_logs(start_time=max(start_time - 600, first_node_start_time), attach_name='kikimr_start')
255262
if error is not None:
256263
exc = pytest.fail.Exception(error)

0 commit comments

Comments
 (0)