Skip to content

Commit efab99b

Browse files
committed
Fix flaky txn_cleanup_range_async_commit_locks test
txn_cleanup_locks_batch_size intentionally leaves locks behind (it tests that the before-cleanup-locks failpoint prevents actual cleanup). After scenario.teardown() disables failpoints, the locks remain in TiKV and can bleed into subsequent tests that assert exact lock counts. Add an actual cleanup step after teardown so no stale locks persist. Made-with: Cursor
1 parent 72d7f02 commit efab99b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

tests/failpoint_tests.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ async fn txn_cleanup_locks_batch_size() -> Result<()> {
132132
assert_eq!(count_locks(&client).await?, keys.len());
133133

134134
scenario.teardown();
135+
136+
// Clean up remaining locks to avoid affecting subsequent tests.
137+
let safepoint = client.current_timestamp().await?;
138+
let options = ResolveLocksOptions {
139+
async_commit_only: false,
140+
..Default::default()
141+
};
142+
client.cleanup_locks(.., &safepoint, options).await?;
143+
assert_eq!(count_locks(&client).await?, 0);
144+
135145
Ok(())
136146
}
137147

0 commit comments

Comments
 (0)