antithesis: Add DROP TABLE parallel driver

This commit is contained in:
Pekka Enberg
2025-07-21 13:15:51 +03:00
parent bd30cb313c
commit 08e1f4a971

View File

@@ -0,0 +1,44 @@
#!/usr/bin/env -S python3 -u
import turso
from antithesis.random import get_random
# Get initial state
try:
con_init = turso.connect("init_state.db")
except Exception as e:
print(f"Error connecting to database: {e}")
exit(0)
cur_init = con_init.cursor()
# Get all existing tables from schemas
existing_schemas = cur_init.execute("SELECT tbl FROM schemas").fetchall()
if not existing_schemas:
print("No tables found in schemas")
exit(0)
# Select a random table
selected_idx = get_random() % len(existing_schemas)
selected_tbl = existing_schemas[selected_idx][0]
try:
con = turso.connect("stress_composer.db", experimental_indexes=True)
except Exception as e:
print(f"Failed to open stress_composer.db. Exiting... {e}")
exit(0)
cur = con.cursor()
cur.execute(f"DROP TABLE tbl_{selected_tbl}")
con.commit()
con.close()
cur_init.execute("DELETE FROM schemas WHERE tbl = ?", (selected_tbl,))
con_init.commit()
con_init.close()