mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 00:54:19 +01:00
antithesis-tests: Don't fail tests on unique constraint violation
Unique constraint violation is not an error.
This commit is contained in:
@@ -24,8 +24,16 @@ print(f'Inserting {insertions} rows...')
|
||||
|
||||
for i in range(insertions):
|
||||
values = [generate_random_value(tbl_schema[f'col_{col}']['data_type']) for col in range(tbl_schema['colCount'])]
|
||||
cur.execute(f'''
|
||||
INSERT INTO tbl_{selected_tbl} ({cols})
|
||||
VALUES ({', '.join(values)})
|
||||
''')
|
||||
try:
|
||||
cur.execute(f'''
|
||||
INSERT INTO tbl_{selected_tbl} ({cols})
|
||||
VALUES ({', '.join(values)})
|
||||
''')
|
||||
except limbo.OperationalError as e:
|
||||
if "UNIQUE constraint failed" in str(e):
|
||||
# Ignore UNIQUE constraint violations
|
||||
pass
|
||||
else:
|
||||
# Re-raise other operational errors
|
||||
raise
|
||||
|
||||
|
||||
Reference in New Issue
Block a user