Skip to content

Commit d2f497c

Browse files
zzylolclaude
andauthored
Store correctness contract test suite (#212)
* Add Store correctness contract test suite Defines a run_contract_suite() function that tests every observable behaviour of a Store implementation: - Empty-store edge cases (range query, exact query, earliest timestamp) - Single insert: range query hit/miss, exact query hit/miss (wrong start, wrong end) - Batch insert: count correctness, chronological ordering guaranteed - Partial range filtering (windows outside query range excluded) - Aggregation-ID isolation (inserts into agg 1 not visible to agg 2) - Earliest-timestamp tracking: global minimum, per agg-ID - Cleanup — CircularBuffer: oldest window evicted, newest 8 retained - Cleanup — ReadBased: evicted after threshold reads, unread window kept - Concurrency: 8-thread concurrent inserts (no data loss), 8-thread concurrent reads (each returns full result set) Two test entry points exercise both existing implementations: contract_per_key — LockStrategy::PerKey (reference) contract_global — LockStrategy::Global Adding a new Store implementation requires only a new #[test] function that calls run_contract_suite() with the new factory. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Extend store contract tests: all accumulator types, keyed entries, DeltaSet exclusion - Add SerializableToSink import so clone-fidelity tests compile on concrete types - Clone fidelity tests for all 11 accumulator types: SumAccumulator, MinMaxAccumulator, DatasketchesKLLAccumulator, IncreaseAccumulator, MultipleSumAccumulator, MultipleMinMaxAccumulator, SetAggregatorAccumulator, DeltaSetAggregatorAccumulator, CountMinSketchAccumulator, CountMinSketchWithHeapAccumulator, HydraKllSketchAccumulator - Three keyed-entry tests: grouping by key, coexistence of keyed/unkeyed, multiple keys per window - DeltaSetAggregator cleanup exclusion test - Concurrency tests: concurrent inserts (8 threads) and concurrent reads Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix cargo fmt violations in store_correctness_tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Remove unused assert_clone_fidelity function (clippy dead_code) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix extra blank line (cargo fmt) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e6e1858 commit d2f497c

2 files changed

Lines changed: 994 additions & 0 deletions

File tree

asap-query-engine/src/tests/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pub mod elastic_forwarding_tests;
44
pub mod prometheus_forwarding_tests;
55
pub mod query_equivalence_tests;
66
pub mod sql_pattern_matching_tests;
7+
pub mod store_correctness_tests;
78
pub mod trait_design_tests;
89

910
#[cfg(test)]

0 commit comments

Comments
 (0)