Skip to content

Commit 709a1eb

Browse files
committed
tests: update test for read-only file handling and remove root privileges
1 parent a46b5fe commit 709a1eb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/sr/finder/api/hashchecker.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ mod tests {
236236
path::{Path, PathBuf},
237237
};
238238

239+
use capctl::{CapSet, CapState};
239240
use log::debug;
240241
use nix::sys::stat::{fchmodat, Mode};
241242
use rar_common::{
@@ -394,7 +395,14 @@ mod tests {
394395
#[test]
395396
fn test_read_only_immutable() {
396397
register();
397-
let filename = "test_ro.sh";
398+
// remove root privileges
399+
let current = CapState::get_current();
400+
let mut current = current.unwrap();
401+
current.effective = CapSet::empty();
402+
current.permitted = CapSet::empty();
403+
current.inheritable = CapSet::empty();
404+
current.set_current().unwrap();
405+
let filename = "/tmp/test_ro.sh";
398406
let _cleanup = defer(|| {
399407
let filename = PathBuf::from(filename)
400408
.canonicalize()

0 commit comments

Comments
 (0)