From 74fc789719bdc84c71576daadb0a3fe32bea0d44 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Thu, 19 Jun 2025 13:55:36 +0300 Subject: [PATCH] antithesis: Add integritycheck parallel driver --- .../parallel_driver_integritycheck.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 antithesis-tests/stress-composer/parallel_driver_integritycheck.py diff --git a/antithesis-tests/stress-composer/parallel_driver_integritycheck.py b/antithesis-tests/stress-composer/parallel_driver_integritycheck.py new file mode 100755 index 000000000..277392e4c --- /dev/null +++ b/antithesis-tests/stress-composer/parallel_driver_integritycheck.py @@ -0,0 +1,33 @@ +#!/usr/bin/env -S python3 -u + +import json +import limbo +from antithesis.random import get_random +from antithesis.assertions import always + +# Get initial state +try: + con_init = limbo.connect('init_state.db') +except Exception as e: + print(f"Error connecting to database: {e}") + exit(0) + +cur_init = con_init.cursor() + +tbl_len = cur_init.execute('SELECT count FROM tables').fetchone()[0] +selected_tbl = get_random() % tbl_len +tbl_schema = json.loads(cur_init.execute(f'SELECT schema FROM schemas WHERE tbl = {selected_tbl}').fetchone()[0]) +cols = ', '.join([f'col_{col}' for col in range(tbl_schema['colCount'])]) + +try: + con = limbo.connect('stress_composer.db') +except limbo.OperationalError as e: + print(f'Failed to open stress_composer.db. Exiting... {e}') + exit(0) +cur = con.cursor(); + +print('Running integrity check...') + +result = cur.execute("PRAGMA integrity_check") +row = result.fetchone() +always(row == ("ok",), f"Integrity check failed: {row}", {}) \ No newline at end of file