Skip to content

Commit e932aac

Browse files
committed
test(storage): assert gate membership in compaction filter test
The compaction filter test gate is process-global: any Remove decision from concurrently running tests is recorded into the installed gate. Three sibling tests produce Remove for byte-identical key bytes without taking the serial mutex, so test_removes_data_if_meta_is_expired could observe the key recorded twice and fail its exact-equality assertion (surfaced under AddressSanitizer where the race window is wider), and its panic then poisoned the serial mutex, cascading PoisonError failures in the redis.rs lifecycle tests. Assert membership instead, matching the convention already used by the lifecycle tests.
1 parent c3dda2b commit e932aac

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/storage/src/data_compaction_filter.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -919,9 +919,13 @@ mod tests {
919919

920920
let decision = filter.filter(0, &data_key, b"");
921921
assert!(matches!(decision, CompactionDecision::Remove));
922-
assert_eq!(
923-
gate.wait_until_removed(std::time::Duration::from_secs(1)),
924-
vec![data_key]
922+
// The gate is process-global and sibling tests produce Remove decisions
923+
// for the identical key bytes, so assert membership rather than exact
924+
// contents (same convention as the redis.rs lifecycle tests).
925+
let removed_keys = gate.wait_until_removed(std::time::Duration::from_secs(1));
926+
assert!(
927+
removed_keys.contains(&data_key),
928+
"expired data key should be recorded as removed, got {removed_keys:?}"
925929
);
926930
}
927931

0 commit comments

Comments
 (0)