test: cover sharded KAR failure recovery paths
Linux / verify (pull_request) Successful in 2m35s
Linux / changed-scope-coverage (pull_request) Skipped
Linux / keyless-cuda (pull_request) Skipped
Linux / hosted-cuda-package (pull_request) Skipped
Linux / linux-cli-container (pull_request) Successful in 1m40s
Linux / linux-static-cli (pull_request) Successful in 5m32s
Linux / release-cli (pull_request) Skipped
Linux / verify (pull_request) Successful in 2m35s
Linux / changed-scope-coverage (pull_request) Skipped
Linux / keyless-cuda (pull_request) Skipped
Linux / hosted-cuda-package (pull_request) Skipped
Linux / linux-cli-container (pull_request) Successful in 1m40s
Linux / linux-static-cli (pull_request) Successful in 5m32s
Linux / release-cli (pull_request) Skipped
This commit is contained in:
@@ -2993,6 +2993,18 @@ mod tests {
|
||||
assert!(round_up(u64::MAX, 256).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nested_layout_propagates_section_alignment_overflow() {
|
||||
let offsets = NestedOffsets {
|
||||
books: 0,
|
||||
planes: u64::MAX - 1,
|
||||
stride: 1,
|
||||
end: u64::MAX,
|
||||
};
|
||||
let result = finish_nested_layout(0, 32, 1, 2, offsets);
|
||||
assert!(result.is_err_and(|error| error.contains("aligned offset overflow")));
|
||||
}
|
||||
|
||||
fn assert_invalid_nested_layout_parameters() {
|
||||
for (group, nesting, min, max, levels) in [
|
||||
(0, 0, 1, 2, 2),
|
||||
|
||||
@@ -4662,6 +4662,66 @@ mod tests {
|
||||
fs::remove_dir_all(directory).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn eager_sharded_prepare_preserves_reserved_sidecar_and_removes_archive() {
|
||||
let fixture = overlay_fixture();
|
||||
let output = fixture.directory.join("legacy.kar");
|
||||
let sidecar = provenance_path(&output).unwrap();
|
||||
fs::write(&sidecar, b"reserved provenance").unwrap();
|
||||
|
||||
assert!(prepare_sharded(&fixture.manifest, &fixture.directory, &output, 2).is_err());
|
||||
|
||||
assert!(!output.exists());
|
||||
assert_eq!(fs::read(&sidecar).unwrap(), b"reserved provenance");
|
||||
assert!(!legacy_staging_path(&output).exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn eager_sharded_prepare_rejects_reserved_staging_without_mutation() {
|
||||
let fixture = overlay_fixture();
|
||||
let output = fixture.directory.join("legacy.kar");
|
||||
let staging = legacy_staging_path(&output);
|
||||
fs::create_dir(&staging).unwrap();
|
||||
let sentinel = staging.join("owned-by-another-writer");
|
||||
fs::write(&sentinel, b"keep").unwrap();
|
||||
|
||||
assert!(prepare_sharded(&fixture.manifest, &fixture.directory, &output, 2).is_err());
|
||||
|
||||
assert!(!output.exists());
|
||||
assert_eq!(fs::read(sentinel).unwrap(), b"keep");
|
||||
fs::remove_dir_all(staging).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn eager_sharded_prepare_rejects_invalid_levels_before_staging() {
|
||||
let fixture = overlay_fixture();
|
||||
let output = fixture.directory.join("legacy.kar");
|
||||
|
||||
assert!(
|
||||
prepare_sharded(&fixture.manifest, &fixture.directory, &output, 0)
|
||||
.unwrap_err()
|
||||
.contains("1..=8")
|
||||
);
|
||||
|
||||
assert!(!output.exists());
|
||||
assert!(!legacy_staging_path(&output).exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn preview_kind_names_are_stable_for_validation_errors() {
|
||||
assert_eq!(preview_kind_name(PreviewKind::F32), "F32");
|
||||
assert_eq!(preview_kind_name(PreviewKind::Iq3), "IQ3_S");
|
||||
assert_eq!(preview_kind_name(PreviewKind::Mixed), "F32/F16/BF16/IQ3_S");
|
||||
}
|
||||
|
||||
fn legacy_staging_path(output: &Path) -> PathBuf {
|
||||
output.with_file_name(format!(
|
||||
"{}.parts-{}",
|
||||
output.file_name().unwrap().to_string_lossy(),
|
||||
std::process::id()
|
||||
))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn streamed_prepare_parent_symlink_retarget_keeps_archive_and_provenance_together() {
|
||||
let directory = preview_test_path("stream-symlink-output", "dir");
|
||||
|
||||
Reference in New Issue
Block a user