diff options
| author | Hermes Agent <hermes@localhost> | 2026-08-12 06:02:57 +0000 |
|---|---|---|
| committer | Hermes Agent <hermes@localhost> | 2026-08-12 06:02:57 +0000 |
| commit | c7dc1a0173a14e9cb52adcb09ae566cf7eeb314a (patch) | |
| tree | 62661aaa98e09a9abadb676dec1863469464ce5a /tests/compare.rs | |
| parent | 35af190cac33650b90e8056b890b8c2c03dca7e7 (diff) | |
Protect companion manifests from overwrite
Diffstat (limited to 'tests/compare.rs')
| -rw-r--r-- | tests/compare.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/compare.rs b/tests/compare.rs index f7b3a04..4f48721 100644 --- a/tests/compare.rs +++ b/tests/compare.rs @@ -159,6 +159,21 @@ fn writes_distinct_manifests_for_artifacts_in_the_same_directory() { } #[test] +fn refuses_to_overwrite_an_existing_companion_manifest() { + let fixture = tempdir().expect("temporary directory"); + let artifact = fixture.path().join("controller.tar"); + let manifest_path = ArtifactManifest::path_beside(&artifact).expect("manifest path"); + fs::write(&manifest_path, "preserve this manifest").expect("write existing manifest"); + + let error = baseline() + .write_beside(&artifact) + .expect_err("existing companion manifests must not be overwritten"); + + assert!(error.to_string().contains("create artifact manifest")); + assert_eq!(fs::read_to_string(&manifest_path).expect("read existing manifest"), "preserve this manifest"); +} + +#[test] fn rejects_duplicate_semantic_keys() { let error = ArtifactManifest::new( vec![PackageRecord::new("controller", "1"), PackageRecord::new("controller", "2")], |