Idunn credential rule: an unlistable credential directory is a refusal
cargo-mutants showed that treating every read_dir error as the empty set survived. Test the non-NotFound case (the unit path is a file). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ae6a1bea55
commit
dfdc226c25
1 changed files with 8 additions and 0 deletions
|
|
@ -10128,6 +10128,14 @@ processes 9
|
|||
"systemd delivered credentials that differ from the Idunn launch"
|
||||
);
|
||||
}
|
||||
// A directory that cannot be listed is a refusal, never the empty set.
|
||||
let temp = tempfile::tempdir()?;
|
||||
let parent = temp.path().join("run/credentials");
|
||||
std::fs::create_dir_all(&parent)?;
|
||||
std::fs::write(parent.join(unit), "")?;
|
||||
let error = require_delivered_credentials(temp.path(), unit, &[])
|
||||
.expect_err("an unreadable credential directory must be refused");
|
||||
assert!(!format!("{error:#}").contains(&*temp.path().to_string_lossy()));
|
||||
// The rule reads the process root it is given, never the host's /run.
|
||||
let temp = tempfile::tempdir()?;
|
||||
let outside = tempfile::tempdir()?;
|
||||
|
|
|
|||
Loading…
Reference in a new issue