v0.39.2
This commit is contained in:
1 parent
5b2eaaff61
commit
3b5fc8dce1
5 files changed
+175
-2
No files matched your search
+54
-1
@@ -132,8 +132,61 @@ mod cache_revision_tests {
|
||||
CacheInvalidation::None
|
||||
));
|
||||
|
||||
// Operational cache tuning keeps HOT/COLD objects.
|
||||
let mut tuning = base.clone();
|
||||
tuning.cache.max_entries += 1;
|
||||
tuning.cache.max_bytes *= 2;
|
||||
tuning.cache.max_object_bytes /= 2;
|
||||
tuning.cache.transient_max_bytes *= 2;
|
||||
tuning.cache.hot_eviction_max_objects += 1;
|
||||
tuning.cache.hot_auto_trim_enabled = !base.cache.hot_auto_trim_enabled;
|
||||
tuning.cache.hot_auto_trim_after_seconds += 10;
|
||||
tuning.cache.hot_auto_trim_target_percent = 70;
|
||||
tuning.cache.cold_max_bytes *= 2;
|
||||
tuning.cache.cold_max_entries += 1;
|
||||
tuning.cache.cold_gc_interval_seconds += 1;
|
||||
tuning.cache.cold_gc_max_delete += 1;
|
||||
tuning.cache.cold_after_seconds += 1;
|
||||
tuning.cache.cold_on_idle = !base.cache.cold_on_idle;
|
||||
tuning.cache.cold_max_hot_seconds += 1;
|
||||
tuning.cache.cold_on_age = !base.cache.cold_on_age;
|
||||
tuning.cache.cold_on_lru = !base.cache.cold_on_lru;
|
||||
tuning.cache.cold_on_shutdown = !base.cache.cold_on_shutdown;
|
||||
tuning.cache.collapse_enabled = !base.cache.collapse_enabled;
|
||||
tuning.cache.collapse_wait_timeout_ms += 1;
|
||||
tuning.cache.stale_if_error_timeout = !base.cache.stale_if_error_timeout;
|
||||
tuning.cache.stale_if_error_statuses = vec![503];
|
||||
tuning.cache.proactive_refresh_enabled = !base.cache.proactive_refresh_enabled;
|
||||
tuning.cache.proactive_refresh_percent = 20;
|
||||
tuning.cache.proactive_refresh_max_inflight = 8;
|
||||
assert_eq!(cache_revision(&tuning), identity);
|
||||
assert!(matches!(
|
||||
cache_invalidation(&base, &tuning),
|
||||
CacheInvalidation::None
|
||||
));
|
||||
|
||||
// Representation and privacy settings still purge everything.
|
||||
for change in [
|
||||
(|c: &mut config::Config| c.cache.default_ttl_seconds += 60) as fn(&mut config::Config),
|
||||
|c| c.cache.max_ttl_seconds += 60,
|
||||
|c| c.cache.varnish_grace_seconds += 1,
|
||||
|c| c.cache.varnish_compatible = !c.cache.varnish_compatible,
|
||||
|c| c.cache.static_ignore_cookies = !c.cache.static_ignore_cookies,
|
||||
|c| c.cache.static_ignore_vary_cookie = !c.cache.static_ignore_vary_cookie,
|
||||
|c| c.cache.static_extensions.push("json".into()),
|
||||
|c| c.cache.cold_enabled = !c.cache.cold_enabled,
|
||||
|c| c.cache.rules.push(serde_json::from_value(serde_json::json!(
|
||||
{"id": "x", "conditions": [{"field": "path", "operator": "prefix", "values": ["/a"]}],
|
||||
"actions": [{"type": "pass"}]})).unwrap()),
|
||||
] {
|
||||
let mut changed = base.clone();
|
||||
change(&mut changed);
|
||||
assert_ne!(cache_revision(&changed), identity);
|
||||
assert!(matches!(cache_invalidation(&base, &changed), CacheInvalidation::All(_)));
|
||||
}
|
||||
|
||||
let mut cache = base.clone();
|
||||
cache.cache.max_entries += 1;
|
||||
cache.cache.default_ttl_seconds += 1;
|
||||
let cache_identity = cache_revision(&cache);
|
||||
assert_ne!(cache_identity, identity);
|
||||
assert!(matches!(
|
||||
|
||||
Reference in new issue
Block a user