Skip to content

Commit 2ae2ae4

Browse files
authored
adding flushall after memtier benchmark failure. (#320)
* adding flushall after memtier benchmark failure. Otherwise the database may be in a corrupted state for the next test * added another flushall for the general exception handler
1 parent 13a2b96 commit 2ae2ae4

File tree

1 file changed

+17
-0
lines changed
  • redis_benchmarks_specification/__runner__

1 file changed

+17
-0
lines changed

redis_benchmarks_specification/__runner__/runner.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2671,6 +2671,14 @@ def delete_temporary_files(
26712671

26722672
if not success:
26732673
logging.error(f"Memtier benchmark failed: {stderr}")
2674+
# Clean up database after failure (timeout or error)
2675+
if args.flushall_on_every_test_end or args.flushall_on_every_test_start:
2676+
logging.warning("Benchmark failed - cleaning up database with FLUSHALL")
2677+
try:
2678+
for r in redis_conns:
2679+
r.flushall()
2680+
except Exception as e:
2681+
logging.error(f"FLUSHALL failed after benchmark failure: {e}")
26742682
# Continue with the test but log the failure
26752683
client_container_stdout = f"ERROR: {stderr}"
26762684

@@ -3016,6 +3024,15 @@ def delete_temporary_files(
30163024
print("-" * 60)
30173025
test_result = False
30183026

3027+
# Clean up database after exception to prevent contamination of next test
3028+
if args.flushall_on_every_test_end or args.flushall_on_every_test_start:
3029+
logging.warning("Exception caught - cleaning up database with FLUSHALL")
3030+
try:
3031+
for r in redis_conns:
3032+
r.flushall()
3033+
except Exception as e:
3034+
logging.error(f"FLUSHALL failed after exception: {e}")
3035+
30193036
# Check if user requested exit via Ctrl+C
30203037
if _exit_requested:
30213038
logging.info(

0 commit comments

Comments
 (0)