v0.34.0_1
This commit is contained in:
1 parent
9b3d6731cc
commit
00f29f92c8
68 files changed
+2599
-513
No files matched your search
Vendored
+35
@@ -774,4 +774,39 @@ fn cold_path_cannot_escape_data_directory() {
|
||||
settings.cold_path = "cache/cold".into();
|
||||
assert!(settings.validate().is_ok());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn cold_scope_fingerprint_preserves_unmodified_vhost_and_rejects_stale_restart() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let settings = cold_settings();
|
||||
let shutdown = CancellationToken::new();
|
||||
let mut fingerprints = HashMap::new();
|
||||
fingerprints.insert("cold-test".to_owned(), 77);
|
||||
let cache = Cache::start_with_scope_revisions(
|
||||
11, Some(dir.path().to_path_buf()), settings.clone(), shutdown.clone(),
|
||||
fingerprints.clone(),
|
||||
);
|
||||
fill(&cache, &settings, "/one", "stable-contents").await;
|
||||
fill(&cache, &settings, "/two", "second-contents").await;
|
||||
wait_for_cold(&cache, 1).await;
|
||||
shutdown.cancel();
|
||||
drop(cache);
|
||||
|
||||
let restart = CancellationToken::new();
|
||||
let same = Cache::start_with_scope_revisions(
|
||||
11, Some(dir.path().to_path_buf()), settings.clone(), restart.clone(),
|
||||
fingerprints.clone(),
|
||||
);
|
||||
assert_eq!(same.view().cold_entries, 1, "operational saves retain COLD");
|
||||
restart.cancel();
|
||||
drop(same);
|
||||
|
||||
fingerprints.insert("cold-test".to_owned(), 78);
|
||||
let restart = CancellationToken::new();
|
||||
let changed = Cache::start_with_scope_revisions(
|
||||
11, Some(dir.path().to_path_buf()), settings.clone(), restart.clone(), fingerprints,
|
||||
);
|
||||
assert_eq!(changed.view().cold_entries, 0, "old COLD must never survive a content revision");
|
||||
restart.cancel();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user