Skip to content

Commit de33584

Browse files
ci: Stabilize flaky ttl_evicts_even_with_frequent_access test in tiles_test (#2715)
- [x] Reproduce `ttl_evicts_even_with_frequent_access` failure multiple times in `-p martin-core --test tiles_test` - [x] Identify root cause in test/cache timing behavior and define minimal fix - [x] Implement minimal code/test change to remove flakiness - [x] Re-run targeted tests multiple times to confirm the flake is fixed - [x] Run broader relevant martin-core cache tests to guard regressions - [x] Run parallel validation (code review + CodeQL) - [x] Create pull request --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com>
1 parent cc79de5 commit de33584

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

martin-core/tests/tiles_test.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,22 @@ async fn cache_entry_evicted_after_ttl_expires() {
3737
#[tokio::test]
3838
async fn ttl_evicts_even_with_frequent_access() {
3939
// TTL evicts entries regardless of access pattern (unlike TTI)
40-
let ttl = Duration::from_millis(80);
40+
let ttl = Duration::from_millis(200);
4141
let cache = TileCache::new(CACHE_SIZE, Some(ttl), None);
4242

4343
insert(&cache, "src", ORIGIN, None, b"data").await;
4444

4545
// Access repeatedly — this should NOT extend the TTL
4646
for _ in 0..3 {
47-
tokio::time::sleep(Duration::from_millis(20)).await;
47+
tokio::time::sleep(Duration::from_millis(30)).await;
4848
assert_hit(&cache, "src", ORIGIN).await;
4949
}
5050

51-
wait_and_flush(&cache, Duration::from_millis(30)).await;
51+
// Still before TTL expiration.
52+
tokio::time::sleep(Duration::from_millis(60)).await;
53+
assert_hit(&cache, "src", ORIGIN).await;
54+
55+
wait_and_flush(&cache, Duration::from_millis(80)).await;
5256

5357
assert_miss(&cache, "src", ORIGIN, None, b"new").await;
5458
}

0 commit comments

Comments
 (0)