-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Company or project name
Individual Contributor (Open Source)
Describe what's wrong
I identified three critical reliability issues in tests/integration/test_database_replicated/test.py that cause test flakiness and environment corruption:
-
Thread Leakage / Race Condition: In
test_force_synchronous_settings, background threads (start_merges_threadandselect_thread) are started, but their.join()calls are placed after assertions. If an assertion fails, the test aborts, leaving the threads running. These "zombie" threads continue executing queries against the database while subsequent tests run, leading to race conditions and random failures in the rest of the suite. -
Unsafe Environment Modification: The test
test_mv_false_cyclic_dependencyexplicitly executesDROP DATABASE default. This destroys the system default database, which violates test isolation and poisons the environment for other tests running in parallel or subsequently. -
Global Mutable State: The test relies on a global variable
test_recover_staled_replica_runto track state between runs, which makes the test order-dependent and prevents it from being run multiple times reliably.
Does it reproduce on the most recent release?
Yes
How to reproduce
To observe the logic defects, examine tests/integration/test_database_replicated/test.py.
To simulate the crash/hang:
- Modify
test_force_synchronous_settingsto force an assertion failure before the.join()call. - Run the test suite using
pytest. - Observe that the background threads are not cleaned up, potentially causing the next test to fail or the suite to hang.
Command:
pytest tests/integration/test_database_replicated/test.py
Expected behavior
No response
Error message and/or stacktrace
No response
Additional context
No response