Skip to content

Commit 1821900

Browse files
πŸ§ͺ Add missing error path test for extract_manifest
🎯 **What:** Adds a missing test coverage for `extract_manifest` error path when required file paths do not exist. πŸ“Š **Coverage:** Tests that missing upstream tools, commands or entrypoint file results in a clear `std::io::ErrorKind::NotFound` Error being surfaced without panics. ✨ **Result:** Improved robustness by asserting on standard Rust IO error variants when file sources cannot be read, enabling safer compatibility manifest loading logic across temporary directories and dynamic contexts. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent efd7cfd commit 1821900

4 files changed

Lines changed: 34 additions & 3 deletions

File tree

β€Žpatch_pr.pyβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import sys
21

32
def replace_in_file(filepath, search_str, replace_str):
43
with open(filepath, 'r') as f:

β€Žrust/Cargo.lockβ€Ž

Lines changed: 22 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žrust/crates/compat-harness/Cargo.tomlβ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ runtime = { path = "../runtime" }
1212

1313
[lints]
1414
workspace = true
15+
16+
[dev-dependencies]
17+
tempfile = "3.27.0"

β€Žrust/crates/compat-harness/src/lib.rsβ€Ž

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,4 +354,13 @@ mod tests {
354354
assert!(names.contains(&"AgentTool"));
355355
assert!(names.contains(&"BashTool"));
356356
}
357+
358+
#[test]
359+
fn extract_manifest_returns_not_found_for_invalid_paths() {
360+
let temp = tempfile::tempdir().unwrap();
361+
let paths = UpstreamPaths::from_repo_root(temp.path());
362+
let result = extract_manifest(&paths);
363+
let err = result.expect_err("should fail when files do not exist");
364+
assert_eq!(err.kind(), std::io::ErrorKind::NotFound);
365+
}
357366
}

0 commit comments

Comments
Β (0)