From 698136b30c3a7ab1f493536634e479dffe5c8b4c Mon Sep 17 00:00:00 2001 From: link2xt Date: Wed, 11 Dec 2024 23:09:39 +0000 Subject: [PATCH] test: test that HTTP cache can be renewed without housekeeping --- src/net/http.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/net/http.rs b/src/net/http.rs index 814fe57ac..fe3d90898 100644 --- a/src/net/http.rs +++ b/src/net/http.rs @@ -428,6 +428,14 @@ mod tests { Some(xdc_response.clone()) ); + // Expired cache entry can be renewed + // even before housekeeping removes old one. + http_cache_put(t, "https://webxdc.org/", &html_response).await?; + assert_eq!( + http_cache_get(t, "https://webxdc.org/").await?, + Some(html_response.clone()) + ); + // 35 days later pixel .xdc expires because we did not request it for 35 days and 1 hour. // But editor is still there because we did not request it for just 35 days. SystemTime::shift(Duration::from_secs(3600 * 24 * 35 - 100));