Skip to content

Commit 0fb1588

Browse files
authored
increase timeouts in loadtests, fix error processing (#6578)
1 parent 75900f5 commit 0fb1588

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

ydb/tests/olap/lib/ydb_cli.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ def __init__(
4747
@staticmethod
4848
def workload_run(type: WorkloadType, path: str, query_num: int, iterations: int = 5,
4949
timeout: float = 100.) -> YdbCliHelper.WorkloadRunResult:
50+
def _try_extract_error_message(stderr: str) -> str:
51+
begin_str = f'{query_num}:\n'
52+
end_str = 'Query text:\n'
53+
begin_pos = stderr.find(begin_str)
54+
if begin_pos < 0:
55+
return ''
56+
begin_pos += len(begin_str)
57+
end_pos = stderr.find(end_str, begin_pos)
58+
if end_pos < 0:
59+
return stderr[begin_pos:]
60+
return stderr[begin_pos:end_pos]
61+
5062
try:
5163
if not YdbCluster.wait_ydb_alive(60):
5264
return YdbCliHelper.WorkloadRunResult(error_message='Ydb cluster is dead')
@@ -72,13 +84,17 @@ def workload_run(type: WorkloadType, path: str, query_num: int, iterations: int
7284
exec: yatest.common.process._Execution = yatest.common.process.execute(cmd, wait=False, check_exit_code=False)
7385
exec.wait(check_exit_code=False, timeout=timeout)
7486
if exec.returncode != 0:
75-
err = f'Invalid return code: {exec.returncode} instesd 0.'
87+
err = _try_extract_error_message(exec.stderr.decode('utf-8'))
88+
if not err:
89+
err = f'Invalid return code: {exec.returncode} instesd 0.'
7690
except (yatest.common.process.TimeoutError, yatest.common.process.ExecutionTimeoutError):
7791
err = f'Timeout {timeout}s expeared.'
7892
stats = {}
7993
if (os.path.exists(json_path)):
8094
with open(json_path, 'r') as r:
81-
for signal in json.load(r):
95+
json_data = r.read()
96+
if json_data:
97+
for signal in json.loads(json_data):
8298
q = signal['labels']['query']
8399
if q not in stats:
84100
stats[q] = {}

ydb/tests/olap/load/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class LoadSuiteBase:
1111
iterations: int = 5
1212
workload_type: WorkloadType = None
13-
timeout: float = 100.
13+
timeout: float = 300.
1414
refference: str = ''
1515

1616
@property

ydb/tests/olap/load/test_tpcds.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ class TestTpcds1(TpcdsSuiteBase):
2424

2525
class TestTpcds10(TpcdsSuiteBase):
2626
size: int = 10
27-
timeout = 300.
27+
timeout = max(TpcdsSuiteBase.timeout, 300.)
2828

2929

3030
class TestTpcds100(TpcdsSuiteBase):
3131
size: int = 100
32-
timeout = 900.
32+
timeout = max(TpcdsSuiteBase.timeout, 900.)

ydb/tests/olap/load/test_tpch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ class TestTpch10(TpchSuiteBase):
2828

2929
class TestTpch100(TpchSuiteBase):
3030
size: int = 100
31-
timeout = 300.
31+
timeout = max(TpchSuiteBase.timeout, 300.)
3232

3333

3434
class TestTpch1000(TpchSuiteBase):
3535
size: int = 1000
36-
timeout = 1000.
36+
timeout = max(TpchSuiteBase.timeout, 1000.)

0 commit comments

Comments
 (0)