[pbs-devel] [PATCH proxmox-backup 2/2] tape/inventory: fix the tape tests as user, by mocking the lock
Dominik Csapak
d.csapak at proxmox.com
Mon Sep 6 15:07:35 CEST 2021
locking during the tests as regular user failed because we try to
chown to the backup user (which is not always possible).
Instead, do not lock at all, by implementing 'open_backup_lockfile' with
'create_mocked_lock'
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/tape/inventory.rs | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/tape/inventory.rs b/src/tape/inventory.rs
index d56b2144..2ecd73ac 100644
--- a/src/tape/inventory.rs
+++ b/src/tape/inventory.rs
@@ -40,7 +40,20 @@ use proxmox::tools::{
};
use pbs_systemd::time::compute_next_event;
-use pbs_config::{open_backup_lockfile, BackupLockGuard};
+use pbs_config::BackupLockGuard;
+
+#[cfg(not(test))]
+use pbs_config::open_backup_lockfile;
+
+#[cfg(test)]
+fn open_backup_lockfile<P: AsRef<std::path::Path>>(
+ _path: P,
+ _timeout: Option<std::time::Duration>,
+ _exclusive: bool,
+) -> Result<pbs_config::BackupLockGuard, anyhow::Error> {
+ Ok(pbs_config::create_mocked_lock())
+}
+
use crate::{
api2::types::{
--
2.30.2
More information about the pbs-devel
mailing list