From 9a8498fe230d70378fbe58232f81513fda29da45 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 22 Nov 2026 23:25:01 -0800 Subject: [PATCH] test: require a pending plain detach and actual SIGKILL exit --- ...ocedure_plain_detach_crash_integration_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 07f07b9277..018b986609 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 @@ -4,8 +4,10 @@ package main_test import ( "encoding/json" + "errors" "fmt" "net/http" + "os/exec" "syscall" "testing" "time" @@ -48,7 +50,20 @@ 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) } + select { + case <-cli.done: + t.Fatal("detach completed or aborted before the verified kill window") + default: + } holder.kill(t) + var exited *exec.ExitError + if !errors.As(holder.err, &exited) { + t.Fatalf("holder did not have a signal exit: %v", holder.err) + } + status, ok := exited.Sys().(syscall.WaitStatus) + if !ok || !status.Signaled() || status.Signal() != syscall.SIGKILL { + t.Fatalf("holder exit %v; want SIGKILL", exited) + } if err := cli.wait(15 * time.Second); err == nil { t.Fatal("interrupted detach unexpectedly returned success") }