Skip to content

Commit a1ede84

Browse files
committed
feat: add concurrency support to LRU tests
Introduced conditional compilation for concurrency features in the LRU cache tests. Updated `lru_concurrency.rs` to enable tests only when the "concurrency" feature is active. Modified `lru_integration_test.rs` to conditionally include `ConcurrentLruCache` and its associated tests, enhancing the test suite's flexibility and ensuring it aligns with the concurrency design strategy.
1 parent d677683 commit a1ede84

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

tests/lru_concurrency.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg(feature = "concurrency")]
2+
13
use std::sync::Arc;
24
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
35
use std::thread;

tests/lru_integration_test.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ use std::sync::Arc;
22

33
#[cfg(test)]
44
mod integration_tests {
5-
use cachekit::policy::lru::{ConcurrentLruCache, LruCore};
5+
#[cfg(feature = "concurrency")]
6+
use cachekit::policy::lru::ConcurrentLruCache;
7+
use cachekit::policy::lru::LruCore;
68
use cachekit::traits::{CoreCache, LruCacheTrait, MutableCache};
79

810
use super::*;
@@ -46,6 +48,7 @@ mod integration_tests {
4648
println!("✅ Zero-copy LRU core test passed!");
4749
}
4850

51+
#[cfg(feature = "concurrency")]
4952
#[test]
5053
fn test_concurrent_lru_cache() {
5154
let cache = ConcurrentLruCache::new(3);
@@ -83,6 +86,7 @@ mod integration_tests {
8386
println!("✅ Concurrent LRU cache test passed!");
8487
}
8588

89+
#[cfg(feature = "concurrency")]
8690
#[test]
8791
fn test_database_workload_simulation() {
8892
// Simulate a database buffer pool workload

0 commit comments

Comments
 (0)