From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 18C781FF0B2 for ; Mon, 24 Aug 2026 15:13:58 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id E0525215CB; Mon, 24 Aug 2026 15:13:57 +0200 (CEST) Content-Type: text/plain; charset=UTF-8 Date: Mon, 24 Aug 2026 15:13:54 +0200 Message-Id: From: "Lukas Wagner" To: "Robert Obkircher" , "Lukas Wagner" Subject: Re: [PATCH datacenter-manager 11/20] parallel fetcher: pass arguments to closure in a single type Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: aerc 0.21.0-0-g5549850facc2-dirty References: <20260817125727.454039-1-l.wagner@proxmox.com> <20260817125727.454039-12-l.wagner@proxmox.com> <178732083104.243770.17090706260253141150.b4-review@b4> In-Reply-To: <178732083104.243770.17090706260253141150.b4-review@b4> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1787577204675 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.652 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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: P6ZARN3GKMYI6O7Q6NJQYH4Y7ADIUHN6 X-Message-ID-Hash: P6ZARN3GKMYI6O7Q6NJQYH4Y7ADIUHN6 X-MailFrom: l.wagner@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 CC: pdm-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri Aug 21, 2026 at 4:00 PM CEST, Robert Obkircher wrote: >> + >> +extern "C" fn cleanup() { >> + if let Some(dir) =3D STATIC_TEMP_DIR.get() { >> + let _ =3D std::fs::remove_dir_all(dir); >> + } >> +} >> + >> +pub fn test_setup() { >> + static INIT: Once =3D Once::new(); >> + >> + INIT.call_once(|| { >> + let file_opts =3D CreateOptions::new(); >> + >> + let dir =3D proxmox_sys::fs::make_tmp_dir("/tmp", None).unwrap(= ); > > A while ago I had a brief discussion with Fabian about how file I/O > should be tested. He argued that tests should not make any assumptions > about the file system outside of CARGO_TARGET_TMPDIR, not even about > /tmp. > > But that is only available for real integration tests, not for > unittests. Yeah, might make it sense to use it for the tests here, I guess. Right now, we have quite a few unit tests in PDM which use /tmp anyways, for exactly the reason you mentioned. Wondering if there is any sensible approach for these. > >> + STATIC_TEMP_DIR.set(dir.clone()).unwrap(); >> + >> + proxmox_rest_server::init_worker_tasks(dir.clone(), file_opts).= unwrap(); >> + proxmox_access_control::init::init(&pdm_api_types::AccessContro= lConfig, dir) >> + .expect("failed to setup access control config"); >> + >> + unsafe { >> + libc::atexit(cleanup); > > Doesn't this potentially delete files while other threads are stil > accessing them? Its a bit of a crutch admittedly, but I think in the context of integration= tests this should not be a huge issue? If exit() is called, any remaining thread is stopped anyway; it should not be a big deal if any file IO in the temporary directory fails then? Admittedly, I haven't examined the exact behavior of rust's test runner, so maybe I'm missing something here.