[pbs-devel] [PATCH proxmox-backup 2/2] client: pxar: conditionally skip metadata reference test

Christian Ebner c.ebner at proxmox.com
Thu Jun 6 10:17:11 CEST 2024


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 <c.ebner at proxmox.com>
---
 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 d5eb7bd02..56c82fe4d 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!());
 
-- 
2.39.2





More information about the pbs-devel mailing list