From 260c95ab8a3919f65313fec4e9845f55cfbf780b Mon Sep 17 00:00:00 2001 From: pingqiu Date: Tue, 1 Dec 2026 15:08:25 -0800 Subject: [PATCH] test: await async admission and held write in either order --- ...apshot_operation_crash_integration_test.go | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/seaweed-block/cmd/blockvolume/snapshot_operation_crash_integration_test.go b/seaweed-block/cmd/blockvolume/snapshot_operation_crash_integration_test.go index 9a3c71aeee..91a7bbbbc0 100644 --- a/seaweed-block/cmd/blockvolume/snapshot_operation_crash_integration_test.go +++ b/seaweed-block/cmd/blockvolume/snapshot_operation_crash_integration_test.go @@ -105,20 +105,32 @@ func TestSnapshotOperationIntentAndPublicationCrashBoundaries(t *testing.T) { <-done } }() + var admitted snapshotOperationAdmission select { case <-reached: - case a := <-done: + case admitted = <-done: joined = true - t.Fatalf("admission ended before crash boundary %s: %+v", kind, a) + if admitted.err != nil { + t.Fatalf("admission failed before crash boundary %s: %+v", kind, admitted) + } + // Asynchronous admission may return before the worker reaches + // its filer write. Still require that actual held boundary before + // killing; an accepted answer alone is never a crash witness. + select { + case <-reached: + case <-time.After(30 * time.Second): + t.Fatal("accepted operation did not reach the actual filer boundary") + } case <-time.After(30 * time.Second): t.Fatal("snapshot did not reach the actual filer boundary") } - var admitted snapshotOperationAdmission - select { - case admitted = <-done: - joined = true - case <-time.After(2 * time.Second): - t.Fatal("no asynchronous durable-intent admission before the held write; no kill credited") + if !joined { + select { + case admitted = <-done: + joined = true + case <-time.After(2 * time.Second): + t.Fatal("no asynchronous durable-intent admission before the held write; no kill credited") + } } if admitted.err != nil || admitted.answer.ID != requestID || admitted.location == "" || (admitted.answer.State != "accepted" && admitted.answer.State != "running") { t.Fatalf("durable intent admission required before kill: %+v", admitted)