From 5acc52b7f92bd07416f10ff5a27e8a223d92b1d5 Mon Sep 17 00:00:00 2001 From: houseme Date: Sun, 26 Jul 2026 19:30:08 +0800 Subject: [PATCH] test(ilm): cover admission scope parallelism (#5293) * test(ilm): cover cross-bucket admission scope Co-Authored-By: heihutu * fix(ilm): remove duplicate transition progress import Co-Authored-By: heihutu --------- Co-authored-by: heihutu --- .../bucket/lifecycle/bucket_lifecycle_ops.rs | 29 +++++++++++++++---- .../bucket/lifecycle/manual_transition_job.rs | 9 ++++++ 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/crates/ecstore/src/bucket/lifecycle/bucket_lifecycle_ops.rs b/crates/ecstore/src/bucket/lifecycle/bucket_lifecycle_ops.rs index e25326860..2ce54d5fb 100644 --- a/crates/ecstore/src/bucket/lifecycle/bucket_lifecycle_ops.rs +++ b/crates/ecstore/src/bucket/lifecycle/bucket_lifecycle_ops.rs @@ -4627,10 +4627,10 @@ mod tests { load_manual_transition_job_record, load_manual_transition_scope_admission, load_manual_transition_scope_admission_with_etag, manual_transition_scope_record_object_name, manual_transition_worker_result_object_name, manual_transition_worker_result_task_key, - persist_manual_transition_job_progress, reconcile_manual_transition_worker_results, - record_manual_transition_worker_result, renew_manual_transition_job_lease, request_manual_transition_job_cancel, - save_manual_transition_job_record, save_manual_transition_scope_admission_if_absent, - save_manual_transition_scope_admission_if_current, save_manual_transition_worker_result_if_absent, + reconcile_manual_transition_worker_results, record_manual_transition_worker_result, renew_manual_transition_job_lease, + request_manual_transition_job_cancel, save_manual_transition_job_record, + save_manual_transition_scope_admission_if_absent, save_manual_transition_scope_admission_if_current, + save_manual_transition_worker_result_if_absent, }; use crate::bucket::lifecycle::replication_sink::{ ReplicateDecision, ReplicateTargetDecision, ReplicationStatusType, VersionPurgeStatusType, @@ -8622,11 +8622,30 @@ mod tests { assert_eq!(active.scope_key, legacy.scope_key); assert!( matches!( - load_manual_transition_scope_admission(ecstore, &new_record.scope_key).await, + load_manual_transition_scope_admission(ecstore.clone(), &new_record.scope_key).await, Err(Error::ConfigNotFound) ), "conflicted bucket-level admission must be released" ); + + let other_bucket_record = + ManualTransitionJobRecord::new(Uuid::new_v4(), "manual-legacy-scope-other-bucket", &legacy_options, "new-owner"); + save_manual_transition_job_record(ecstore.clone(), &other_bucket_record) + .await + .expect("other bucket job record should save"); + + let other_bucket_claim = claim_manual_transition_scope_admission( + ecstore.clone(), + &ManualTransitionScopeAdmission::from_job(&other_bucket_record), + ) + .await + .expect("cross-bucket admission claim should resolve"); + + assert_eq!(other_bucket_claim, ManualTransitionScopeAdmissionClaim::Claimed); + let current = load_manual_transition_scope_admission(ecstore, &other_bucket_record.scope_key) + .await + .expect("other bucket admission should be saved"); + assert_eq!(current.job_id, other_bucket_record.job_id); } #[tokio::test] diff --git a/crates/ecstore/src/bucket/lifecycle/manual_transition_job.rs b/crates/ecstore/src/bucket/lifecycle/manual_transition_job.rs index 1546f469f..5fbdcccb0 100644 --- a/crates/ecstore/src/bucket/lifecycle/manual_transition_job.rs +++ b/crates/ecstore/src/bucket/lifecycle/manual_transition_job.rs @@ -1741,10 +1741,19 @@ mod tests { ..Default::default() }, ); + let other_bucket = manual_transition_scope_key( + "bucket-b", + &ManualTransitionRunOptions { + prefix: "logs/".to_string(), + tier: Some("warm".to_string()), + ..Default::default() + }, + ); assert_eq!(broad, nested); assert_eq!(broad, disjoint); assert_ne!(broad, dry_run); + assert_ne!(broad, other_bucket); } #[test]