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 4EF031FF150 for ; Mon, 06 Jul 2026 14:28:35 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 0376F21445; Mon, 06 Jul 2026 14:28:35 +0200 (CEST) Message-ID: <78a80f74-7418-4746-bd87-638ef250c5ee@proxmox.com> Date: Mon, 6 Jul 2026 14:28:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Robert Obkircher Subject: Re: [PATCH proxmox-backup v3 12/15] tape: use proxmox-product-config helper for user lookup To: Christian Ebner , pbs-devel@lists.proxmox.com References: <20260701140412.200920-1-c.ebner@proxmox.com> <20260701140412.200920-13-c.ebner@proxmox.com> Content-Language: en-US, de-AT In-Reply-To: <20260701140412.200920-13-c.ebner@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1783340904817 X-SPAM-LEVEL: Spam detection results: 0 DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) 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: IXDAPXNQ3A6KMWDSIW4EMQCOUWLXEB62 X-Message-ID-Hash: IXDAPXNQ3A6KMWDSIW4EMQCOUWLXEB62 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: On 01.07.26 16:05, Christian Ebner wrote: > By this the globally cached user information is used instead of doing > a lookup to be consistent with the rest of the codebase. > > Tests are adapted to call the init exactly once by an init callback > for a LazyLock. This is thread safe, so tests can be run in parallel > without interference. > > [..] > > +static PROXMOX_PRODUCT_CONFIG_INIT_FOR_TESTS: LazyLock = LazyLock::new(|| { > + proxmox_product_config::init( > + pbs_config::backup_user().unwrap(), > + pbs_config::priv_user().unwrap(), > + ); > + true > +}); > + > fn create_testdir(name: &str) -> Result { > let mut testdir: PathBuf = String::from("./target/testout").into(); > testdir.push(std::module_path!()); > @@ -22,6 +31,8 @@ fn create_testdir(name: &str) -> Result { > > #[test] > fn test_alloc_writable_media_1() -> Result<(), Error> { > + assert_eq!(LazyLock::force(&PROXMOX_PRODUCT_CONFIG_INIT_FOR_TESTS), &true); > + > > [..] Wouldn't LazyLock<()> without the assert_eq work as well?