From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 05CAE1FF0E7 for ; Fri, 10 Jul 2026 14:13:29 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 3A75D2143B; Fri, 10 Jul 2026 14:13:28 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 10 Jul 2026 14:13:24 +0200 Message-Id: Subject: Re: [PATCH datacenter-manager 05/15] task cache: add test case for task cache rotation From: "Lukas Wagner" To: "Dominik Csapak" , "Lukas Wagner" , X-Mailer: aerc 0.21.0-0-g5549850facc2-dirty References: <20260702092258.174740-1-l.wagner@proxmox.com> <20260702092258.174740-6-l.wagner@proxmox.com> In-Reply-To: X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1783685593677 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.000 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) 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: YQ3ICJD33X7A6IDLS6EM2WFKF36YTYJ3 X-Message-ID-Hash: YQ3ICJD33X7A6IDLS6EM2WFKF36YTYJ3 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 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 Jul 10, 2026 at 1:35 PM CEST, Dominik Csapak wrote: > some nits inline > > On 7/2/26 11:23 AM, Lukas Wagner wrote: >> This is to ensure that older files are indeed compressed and then later >> removed. >>=20 >> Signed-off-by: Lukas Wagner >> --- >> server/src/remote_tasks/task_cache.rs | 65 +++++++++++++++++++++++++++ >> 1 file changed, 65 insertions(+) >>=20 >> diff --git a/server/src/remote_tasks/task_cache.rs b/server/src/remote_t= asks/task_cache.rs >> index 55aa8b70..aa92fcc8 100644 >> --- a/server/src/remote_tasks/task_cache.rs >> +++ b/server/src/remote_tasks/task_cache.rs >> @@ -1555,4 +1555,69 @@ mod tests { >> assert_eq!(cache.get_tasks(GetTasks::Active).unwrap().count(),= 0); >> assert_eq!(cache.get_tasks(GetTasks::Archived).unwrap().count(= ), 3); >> } >> + >> + #[test] >> + fn archive_file_rotation() { >> + let (_tmp_dir, mut cache) =3D make_cache().unwrap(); >> + cache.rotate_after =3D 100; >> + cache.uncompressed_files =3D 1; >> + cache.max_files =3D 2; >> + >> + let cache =3D cache.write().unwrap(); >> + cache.init(1000).unwrap(); >> + >> + add_tasks(&cache, vec![task(1010, Some(1011)), task(1020, Some(= 1021))]).unwrap(); >> + cache.apply_journal().unwrap(); >> + >> + cache.rotate(1100).unwrap(); >> + >> + let files =3D cache.cache.archive_files(&cache.lock).unwrap(); >> + assert_eq!(files.len(), 2); >> + let first =3D files.get(0).unwrap(); >> + let second =3D files.get(1).unwrap(); >> + >> + assert_eq!(first.compressed, false); > > nit: clippy complains about this line: > > used `assert_eq!` with a literal bool > > so using `assert!(!first.compressed)` > > and below with `assert!(second.compressed)` > > could be better? > Thanks, will be fixed v2.