Implement exact bootstrap recovery and artifact GC
This commit is contained in:
parent
0f4845d4f8
commit
d25942596f
1 changed files with 1631 additions and 48 deletions
|
|
@ -1135,6 +1135,43 @@ fn reclaim_refuses_forged_identity_and_leases() {
|
|||
assert!(fixture.artifact_root(&artifact).exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn selected_gc_is_idempotent_only_at_the_durable_reclaim_boundary() {
|
||||
let fixture = Fixture::new();
|
||||
let artifact = fixture
|
||||
.store
|
||||
.prepare(&fixture.request(
|
||||
71,
|
||||
&[(
|
||||
layer(&[Entry {
|
||||
path: "payload",
|
||||
kind: EntryType::Regular,
|
||||
data: b"gc",
|
||||
target: None,
|
||||
mode: 0o644,
|
||||
}]),
|
||||
OCI_TAR,
|
||||
)],
|
||||
))
|
||||
.unwrap();
|
||||
let id = artifact.prepared_artifact_id;
|
||||
assert!(fixture.store.gc_artifacts(&[id, id]).is_err());
|
||||
|
||||
let lease = lazaret_core::records::ArtifactLease {
|
||||
prepared_artifact_id: id,
|
||||
domain_id: lazaret_core::identity::DomainId::new([72; 32]),
|
||||
generation_id: lazaret_core::identity::GenerationId::new(1),
|
||||
};
|
||||
fixture.catalog.acquire_lease(&lease).unwrap();
|
||||
assert!(fixture.store.gc_artifacts(&[id]).is_err());
|
||||
fixture.catalog.release_lease(&lease).unwrap();
|
||||
|
||||
let result = fixture.store.gc_artifacts(&[id]).unwrap();
|
||||
assert_eq!(result[0].prepared_artifact_id, id);
|
||||
assert_eq!(result[0].outcome, ReclaimOutcome::Removed);
|
||||
assert!(fixture.store.gc_artifacts(&[id]).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn destination_layout_is_materialized_and_canonical_in_artifact_identity() {
|
||||
let fixture = Fixture::new();
|
||||
|
|
|
|||
Loading…
Reference in a new issue