From 81f602d96a22e1c615073da11f64efdc8a0f4e4f Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 22 Nov 2026 23:32:34 -0800 Subject: [PATCH] test: observe the plain upload window without a one-second polling gap --- ...rocedure_plain_detach_crash_integration_test.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/seaweed-block/cmd/blockvolume/procedure_plain_detach_crash_integration_test.go b/seaweed-block/cmd/blockvolume/procedure_plain_detach_crash_integration_test.go index 018b986609..7873adaf42 100644 --- a/seaweed-block/cmd/blockvolume/procedure_plain_detach_crash_integration_test.go +++ b/seaweed-block/cmd/blockvolume/procedure_plain_detach_crash_integration_test.go @@ -32,14 +32,21 @@ func TestProcedureKillDuringPlainDetachThenCompleteHandoff(t *testing.T) { keys := plainDetachStoredKeys(t, env) cli := env.h.start(t, "plain-detach-interrupted", env.h.cli, "ops", "chunk", "detach", "--plain", "--volume", "v1", "--status-addr", env.hosts["s1"].status, "--timeout", "120s") - poll(t, 60*time.Second, "plain detach stored no new immutable chunk", func() bool { + uploadDeadline := time.Now().Add(60 * time.Second) + for { select { case <-cli.done: t.Fatal("detach finished before the mid-upload kill witness") default: } - return plainDetachStoredKeys(t, env) > keys - }) + if plainDetachStoredKeys(t, env) > keys { + break + } + if time.Now().After(uploadDeadline) { + t.Fatal("plain detach stored no new immutable chunk") + } + time.Sleep(2 * time.Millisecond) + } // Stop only this child before reading the remote proof, so the uploader // cannot cross its CAS while the test verifies where the kill will land. if err := holder.proc.Signal(syscall.SIGSTOP); err != nil { @@ -50,6 +57,7 @@ func TestProcedureKillDuringPlainDetachThenCompleteHandoff(t *testing.T) { if err != nil || atKill.Gen != before.Gen || atKill.State != "active" || atKill.RemoteLSN != before.RemoteLSN { t.Fatalf("missed mid-upload window: before=%+v stopped=%+v: %v", before, atKill, err) } + t.Logf("kill witness: immutable keys %d -> %d, HEAD gen=%d LSN=%d remains active", keys, plainDetachStoredKeys(t, env), atKill.Gen, atKill.RemoteLSN) select { case <-cli.done: t.Fatal("detach completed or aborted before the verified kill window")