Skip to content

Commit fa60b65

Browse files
committed
install: add test to set owner to nonexistent userid
1 parent d8dfaee commit fa60b65

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/by-util/test_install.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,3 +1764,18 @@ fn test_install_from_stdin() {
17641764
assert!(at.file_exists(target));
17651765
assert_eq!(at.read(target), test_string);
17661766
}
1767+
1768+
#[test]
1769+
#[cfg(unix)]
1770+
fn test_install_set_owner_nonexistent_userid() {
1771+
if let Ok(result) = run_ucmd_as_root(&ts, args) {
1772+
result.success();
1773+
assert!(at.file_exists(target));
1774+
1775+
let metadata = fs::metadata(at.plus(target)).unwrap();
1776+
assert_eq!(metadata.uid(), expected_uid);
1777+
assert_eq!(metadata.gid(), expected_gid);
1778+
} else {
1779+
print!("Test skipped; requires root user");
1780+
}
1781+
}

0 commit comments

Comments
 (0)