This commit is contained in:
Mateusz Gruszczyński committed 2026-10-17 11:57:16 +02:00
1 parent 6b937aaf85
commit 87c8393d86
79 files changed
+6727 -297

No files matched your search

+17 -6
View File
@@ -556,6 +556,13 @@ mod v022_cache_tests {
#[tokio::test]
async fn selective_purge_exact_prefix_tag_cache_key_and_query_are_precise() {
fn current_ticket(cache: &Cache, old: &Ticket) -> Ticket {
// Each post-PURGE request obtains the current publication generation.
// Reusing an old ticket would reject unrelated entries too and make
// assertions about removed objects pass without testing the selector.
cache.ticket_scoped(22, &old.scope, &old.scheme, &old.authority,
"origin@127.0.0.1:8080", &old.target, &old.request_headers).unwrap()
}
let cache = Cache::new(22);
let one = store(
&cache,
@@ -587,8 +594,9 @@ mod v022_cache_tests {
))
.unwrap();
assert_eq!(result.affected_entries, 1);
assert!(cache.get(&one).is_none());
assert!(cache.get(&two).is_some());
assert!(cache.get(&current_ticket(&cache, &one)).is_none());
let survivor = cache.get(&current_ticket(&cache, &two)).expect("unrelated query remains stored");
assert_eq!(survivor.response.into_body().collect().await.unwrap().to_bytes(), "two");
let three = store(
&cache,
@@ -623,8 +631,9 @@ mod v022_cache_tests {
.affected_entries,
2
);
assert!(cache.get(&three).is_none());
assert!(cache.get(&four).is_none());
assert!(cache.get(&current_ticket(&cache, &three)).is_none());
assert!(cache.get(&current_ticket(&cache, &four)).is_none());
assert!(cache.get(&current_ticket(&cache, &two)).is_some());
let tagged = store(
&cache,
@@ -649,7 +658,8 @@ mod v022_cache_tests {
.affected_entries,
1
);
assert!(cache.get(&tagged).is_none());
assert!(cache.get(&current_ticket(&cache, &tagged)).is_none());
assert!(cache.get(&current_ticket(&cache, &two)).is_some());
let keyed = store(
&cache,
@@ -675,7 +685,8 @@ mod v022_cache_tests {
.affected_entries,
1
);
assert!(cache.get(&keyed).is_none());
assert!(cache.get(&current_ticket(&cache, &keyed)).is_none());
assert!(cache.get(&current_ticket(&cache, &two)).is_some());
}
#[tokio::test]