Files
seaweedfs/weed/command/mini_master_reporter_test.go
T
Chris LuandClaude Opus 5.5 68d56d8ff8 mini: admit volume servers started against the embedded master (#13416)
* mini: admit volume servers started against the embedded master

A single-master weed mini pinned its embedded volume server as the only
admitted reporter, so the master refused every extra weed volume pointed
at it. Use the expected-reporter release a single-master weed server
already uses: the embedded server's first clean inventory still collapses
the post-mint allocation hold, and other volume servers are admitted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* mini: test that a single-master mini does not pin its volume server

Move the reporter choice into setMiniExpectedReporter so a command-level
test can check it: the embedded volume server is the expected reporter
in single-master mode, never the only admitted one, and a multi-master
rerun clears it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 23:52:25 -08:00

32 lines
1.3 KiB
Go

package command
import "testing"
// A single-master mini names its embedded volume server only as the reporter
// whose inventory lifts the post-mint hold; it must not pin it as the only
// admitted one, or volume servers added to the mini are refused.
func TestMiniSingleMasterAdmitsOutsideVolumeServers(t *testing.T) {
oldPeers, oldIp, oldPort := *miniMasterOptions.peers, *miniIp, *miniOptions.v.port
oldExpected := miniMasterOptions.expectedReporterAddr
defer func() {
*miniMasterOptions.peers, *miniIp, *miniOptions.v.port = oldPeers, oldIp, oldPort
miniMasterOptions.expectedReporterAddr = oldExpected
}()
*miniIp, *miniOptions.v.port = "10.0.0.1", 8080
*miniMasterOptions.peers = "none"
setMiniExpectedReporter()
if miniMasterOptions.releaseAllocOnFirstReport || miniMasterOptions.singleReporterAddr != "" {
t.Fatalf("single-master mini pins its embedded volume server: release=%v reporter=%q", miniMasterOptions.releaseAllocOnFirstReport, miniMasterOptions.singleReporterAddr)
}
if got := miniMasterOptions.expectedReporterAddr; got != "10.0.0.1:8080" {
t.Fatalf("expected reporter = %q, want 10.0.0.1:8080", got)
}
*miniMasterOptions.peers = "10.0.0.1:9333,10.0.0.2:9333,10.0.0.3:9333"
setMiniExpectedReporter()
if got := miniMasterOptions.expectedReporterAddr; got != "" {
t.Fatalf("multi-master mini kept expected reporter %q", got)
}
}