From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id ADF891FF139 for ; Tue, 10 Feb 2026 16:06:25 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4F775629A; Tue, 10 Feb 2026 16:07:10 +0100 (CET) From: Robert Obkircher To: pbs-devel@lists.proxmox.com Subject: [PATCH v6 proxmox-backup 04/18] datastore: use temporary directory for chunk store test Date: Tue, 10 Feb 2026 16:06:20 +0100 Message-ID: <20260210150642.469670-5-r.obkircher@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260210150642.469670-1-r.obkircher@proxmox.com> References: <20260210150642.469670-1-r.obkircher@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1770735942275 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.061 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: POQ6KXSBQ3AGN2UTPQM4G6V3G7QA2HYX X-Message-ID-Hash: POQ6KXSBQ3AGN2UTPQM4G6V3G7QA2HYX X-MailFrom: r.obkircher@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Use the systems tmp directory instead of the package root, because the latter might not always be writeable and because the created files weren't even ignored by git. This reduced the tests runtime from 3.2 to 0.6 seconds. Signed-off-by: Robert Obkircher --- pbs-datastore/src/chunk_store.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/pbs-datastore/src/chunk_store.rs b/pbs-datastore/src/chunk_store.rs index bd1dc353..1950be2b 100644 --- a/pbs-datastore/src/chunk_store.rs +++ b/pbs-datastore/src/chunk_store.rs @@ -980,19 +980,17 @@ impl ChunkExt { #[test] fn test_chunk_store1() { - let mut path = std::fs::canonicalize(".").unwrap(); // we need absolute path - path.push(".testdir"); + let temp_dir = crate::temp_dir::TempDir::new().unwrap(); + let path = temp_dir.path(); - if let Err(_e) = std::fs::remove_dir_all(".testdir") { /* ignore */ } - - let chunk_store = ChunkStore::open("test", &path, DatastoreFSyncLevel::None); + let chunk_store = ChunkStore::open("test", path, DatastoreFSyncLevel::None); assert!(chunk_store.is_err()); let user = nix::unistd::User::from_uid(nix::unistd::Uid::current()) .unwrap() .unwrap(); let chunk_store = - ChunkStore::create("test", &path, user.uid, user.gid, DatastoreFSyncLevel::None).unwrap(); + ChunkStore::create("test", path, user.uid, user.gid, DatastoreFSyncLevel::None).unwrap(); let (chunk, digest) = crate::data_blob::DataChunkBuilder::new(&[0u8, 1u8]) .build() @@ -1005,8 +1003,8 @@ fn test_chunk_store1() { assert!(exists); let chunk_store = - ChunkStore::create("test", &path, user.uid, user.gid, DatastoreFSyncLevel::None); + ChunkStore::create("test", path, user.uid, user.gid, DatastoreFSyncLevel::None); assert!(chunk_store.is_err()); - if let Err(_e) = std::fs::remove_dir_all(".testdir") { /* ignore */ } + temp_dir.delete().unwrap(); } -- 2.47.3