mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-07 08:27:12 +00:00
Update test sites to call .to_string() before .contains() since the sandbox Error enum no longer dereferences to String, add use statements to satisfy clippy::absolute_paths, and inline the redundant sandbox_error helpers in fabro-agent to clear needless_pass_by_value. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
34 lines
1.1 KiB
Rust
34 lines
1.1 KiB
Rust
#[test]
|
|
fn context_error_preserves_source_cause() {
|
|
let source = std::io::Error::new(std::io::ErrorKind::PermissionDenied, "permission denied");
|
|
|
|
let error = fabro_sandbox::Error::context("Failed to read file", source);
|
|
|
|
assert_eq!(error.to_string(), "Failed to read file");
|
|
assert_eq!(error.causes(), vec!["permission denied"]);
|
|
assert_eq!(
|
|
error.display_with_causes(),
|
|
"Failed to read file\n caused by: permission denied"
|
|
);
|
|
}
|
|
|
|
#[cfg(feature = "docker")]
|
|
#[test]
|
|
fn docker_image_inspect_error_preserves_source_cause() {
|
|
use bollard::errors::Error as BollardError;
|
|
|
|
let source = BollardError::DockerResponseServerError {
|
|
status_code: 500,
|
|
message: "daemon unavailable".to_string(),
|
|
};
|
|
|
|
let error = fabro_sandbox::Error::docker_image_inspect("buildpack-deps:noble", source);
|
|
|
|
assert_eq!(
|
|
error.to_string(),
|
|
"Failed to inspect Docker image buildpack-deps:noble"
|
|
);
|
|
assert_eq!(error.causes(), vec![
|
|
"Docker responded with status code 500: daemon unavailable"
|
|
]);
|
|
}
|