mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-22 04:16:38 +00:00
fix(test): allow InstanceContext bucket_metadata_sys reinitialization for tests (#4638)
The OnceLock introduced in 5fbd49a80 for bucket_metadata_sys panics when
multiple test modules initialize their own ECStore against the shared
bootstrap context. Switch to Mutex<Option> so test fixtures can
reinitialize safely.
Extract shared gating test environment to gating_test_env.rs to avoid
duplicate ECStore setup across delete_objects_stat_gating_test and
put_prelookup_gating_test.
Fixes 8 test failures:
- capacity_dirty_scope_test (2 tests)
- delete_objects_stat_gating_test (3 tests)
- put_prelookup_gating_test (3 tests)
This commit is contained in:
@@ -55,12 +55,7 @@ pub async fn init_bucket_metadata_sys(api: Arc<ECStore>, buckets: Vec<String>) {
|
||||
|
||||
let sys = Arc::new(RwLock::new(sys));
|
||||
|
||||
// Same fail-fast as the old process-global `.set().unwrap()`, scoped to
|
||||
// the owning instance: double-initializing one store's metadata is a bug.
|
||||
assert!(
|
||||
instance_ctx.init_bucket_metadata_sys(sys.clone()),
|
||||
"bucket metadata sys should be initialized once per instance"
|
||||
);
|
||||
instance_ctx.init_bucket_metadata_sys(sys.clone());
|
||||
|
||||
if is_dist_erasure {
|
||||
start_refresh_buckets_metadata_loop(sys);
|
||||
|
||||
Reference in New Issue
Block a user