test(ecstore): serialize list_objects mutation-sequence tests (#4338)

Three tests share the global list-objects mutation-sequence state (the
LIST_OBJECTS_MUTATION_SEQUENCE atomic and the per-bucket sequence map)
and all call reset_list_objects_mutation_sequences_for_test(), but only
observed_mutation_persists_namespace_journal_high_water was marked
#[serial_test::serial]. The serial lock only excludes tests that also
carry the attribute, so the unmarked tests still ran concurrently with
it: the journal test's persist of "bucket" -> 11 could land after the
recovery test's reset, making it observe 11 instead of the expected 9
(flaky under the default multi-threaded test runner, green with
--test-threads=1).

Add #[serial_test::serial] to the two unmarked tests:
- persistent_key_only_index_load_recovers_mutation_sequence_from_journal
- list_objects_mutation_sequence_advances_per_bucket

Unique bucket names alone would not fix this: the per-bucket assertions
in list_objects_mutation_sequence_advances_per_bucket check exact values
produced by the single global atomic counter, which any concurrent
observe call perturbs, and every reset zeroes that global state for
whichever peer is mid-flight.

Co-authored-by: heihutu <heihutu@gmail.com>
This commit is contained in:
houseme
2026-07-07 04:18:56 +08:00
committed by GitHub
parent 75fab0a842
commit 6d0583872b
+2
View File
@@ -7667,6 +7667,7 @@ mod test {
}
#[tokio::test]
#[serial_test::serial]
async fn persistent_key_only_index_load_recovers_mutation_sequence_from_journal() {
let tempdir = tempfile::tempdir().expect("tempdir should be created");
let index_path = tempdir.path().join("persistent-key-only.index");
@@ -7786,6 +7787,7 @@ mod test {
}
#[tokio::test]
#[serial_test::serial]
async fn list_objects_mutation_sequence_advances_per_bucket() {
reset_list_objects_mutation_sequences_for_test().await;