Files
seaweedfs/seaweed-block/cmd/blockmaster/launcher_replication_ack_flag_test.go
T
pingqiuandClaude Opus 5.5 2da008f236 test(master): the automatic path holds on an ack profile mismatch (red)
The gate reads every frontier rule from blockmaster's
--launcher-replication-ack, but a volume runs its own --replication-ack.
Adds the wire field (ProbeAnswer.ack_profile) and the result fields, with
tests: both gates hold, without fencing, when an answer's profile is
missing or differs from the master's, or the master's is unknown; the
probe round names the mismatch; the volume answers its own profile;
blockmaster refuses an unknown --launcher-replication-ack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 11:27:15 -08:00

24 lines
946 B
Go

package main
import (
"strings"
"testing"
)
// The promotion gate reads every frontier rule from
// --launcher-replication-ack, so blockmaster refuses to start on a profile it
// does not know (as blockvolume refuses its own --replication-ack).
func TestBlockmasterRefusesAnUnknownLauncherReplicationAck(t *testing.T) {
for _, bad := range []string{"bogus", "sync_quorum", ""} {
_, err := parseFlags([]string{"--authority-store", t.TempDir(), "--launcher-replication-ack=" + bad})
if err == nil || !strings.Contains(err.Error(), "--launcher-replication-ack") {
t.Fatalf("--launcher-replication-ack=%q: err=%v; want a refusal naming the flag", bad, err)
}
}
for _, good := range []string{"best-effort", "sync-quorum", "sync-all"} {
if _, err := parseFlags([]string{"--authority-store", t.TempDir(), "--launcher-replication-ack=" + good}); err != nil {
t.Fatalf("--launcher-replication-ack=%q refused: %v", good, err)
}
}
}