antithesis: Fix transaction management

Commit 5216e67d ("bindings/python: Start transaction implicitly in
execute()") fixed transaction management in Python bindings, which means
we now need to execute explicit commit().
This commit is contained in:
Pekka Enberg
2025-07-10 09:00:41 +03:00
parent 24219d2eb2
commit bada750135
5 changed files with 20 additions and 3 deletions

View File

@@ -50,3 +50,5 @@ cur.execute(f"""
INSERT INTO initial_state (num_accts, total)
VALUES ({num_accts}, {total})
""")
con.commit()

View File

@@ -83,4 +83,6 @@ for i in range(tbl_count):
CREATE TABLE tbl_{i} ({cols_str})
""")
con.commit()
print(f"DB Schemas\n------------\n{json.dumps(schemas, indent=2)}")

View File

@@ -37,6 +37,13 @@ print(f"Attempt to delete {deletions} rows in tbl_{selected_tbl}...")
for i in range(deletions):
where_clause = f"col_{pk} = {generate_random_value(tbl_schema[f'col_{pk}']['data_type'])}"
try:
cur.execute(f"""
DELETE FROM tbl_{selected_tbl} WHERE {where_clause}
""")
except turso.OperationalError:
con.rollback()
# Re-raise other operational errors
raise
con.commit()

View File

@@ -44,5 +44,8 @@ for i in range(insertions):
# Ignore UNIQUE constraint violations
pass
else:
con.rollback()
# Re-raise other operational errors
raise
con.commit()

View File

@@ -58,5 +58,8 @@ for i in range(updates):
# Ignore UNIQUE constraint violations
pass
else:
con.rollback()
# Re-raise other operational errors
raise
con.commit()