From 1259234488c4d87539a388e5cbdfceec2bda884a Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Thu, 6 Jun 2024 10:17:11 +0200 Subject: [PATCH] client: pxar: conditionally skip metadata reference test The test will fail for all users not having euid/egid set to 1000/1000, as the reference test folder structure cannot be created with the expected ownership. Therefore, skip over the test if either euid or egid do not match this condition. Signed-off-by: Christian Ebner --- pbs-client/src/pxar/create.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs index d5eb7bd0..56c82fe4 100644 --- a/pbs-client/src/pxar/create.rs +++ b/pbs-client/src/pxar/create.rs @@ -1859,6 +1859,14 @@ mod tests { #[test] fn test_create_archive_with_reference() -> Result<(), Error> { + let euid = unsafe { libc::geteuid() }; + let egid = unsafe { libc::getegid() }; + + if euid != 1000 || egid != 1000 { + // skip test, cannot create test folder structure with correct ownership + return Ok(()); + } + let mut testdir = PathBuf::from("./target/testout"); testdir.push(std::module_path!());