Skip to content

Commit ebced65

Browse files
authored
add retries to bulk upsert in scenario tests (#19355)
1 parent 0b97333 commit ebced65

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ydb/tests/olap/scenario/helpers/scenario_tests_helper.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,13 +363,18 @@ def _bulk_upsert_impl(
363363
self, tablename: str, data_generator: ScenarioTestHelper.IDataGenerator, expected_status: ydb.StatusCode | Set[ydb.StatusCode]
364364
):
365365
fullpath = self.get_full_path(tablename)
366+
expect_success = (expected_status == ydb.StatusCode.SUCCESS)
367+
368+
def _call_upsert(data):
369+
YdbCluster.get_ydb_driver().table_client.bulk_upsert(fullpath, data, data_generator.get_bulk_upsert_columns())
366370

367371
def _upsert():
368372
data = data_generator.generate_data_portion(1000)
369373
allure.attach(repr(data), 'data', allure.attachment_type.TEXT)
370-
YdbCluster.get_ydb_driver().table_client.bulk_upsert(
371-
fullpath, data, data_generator.get_bulk_upsert_columns()
372-
)
374+
if expect_success:
375+
ydb.retry_operation_sync(lambda: _call_upsert(data))
376+
else:
377+
_call_upsert(data)
373378

374379
while not data_generator.EOF():
375380
self._run_with_expected_status(

0 commit comments

Comments
 (0)