Skip to content

Commit 28a23e7

Browse files
Expect (stale) responses after soft purge.
1 parent bd25e9b commit 28a23e7

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

test-fixtures/src/bin/cache.rs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -690,17 +690,24 @@ fn test_soft_purge() {
690690
let key3 = write_key(["keyB"], "value3");
691691

692692
fastly::http::purge::soft_purge_surrogate_key("keyB").unwrap();
693-
// Allow either of two behaviors:
694-
// - Does not return stale results
695-
// - Returns stale results, but marks them stale
696-
if let Some(found) = lookup(key1).execute().unwrap() {
697-
assert!(found.is_stale());
698-
}
699-
if let Some(found) = lookup(key3).execute().unwrap() {
700-
assert!(found.is_stale());
701-
}
693+
// Compute Platform will return stale data that has been soft-purged, if it's still within the
694+
// TTL.
695+
assert!(lookup(key1)
696+
.execute()
697+
.unwrap()
698+
.expect("is found")
699+
.is_stale());
700+
assert!(lookup(key3)
701+
.execute()
702+
.unwrap()
703+
.expect("is found")
704+
.is_stale());
702705
// key2 is untouched:
703-
assert!(!lookup(key2).execute().unwrap().unwrap().is_stale());
706+
assert!(!lookup(key2)
707+
.execute()
708+
.unwrap()
709+
.expect("is found")
710+
.is_stale());
704711
}
705712

706713
fn test_purge_variant() {

0 commit comments

Comments
 (0)