filer: keep the default broker off the debug port (#13242)

weed filer -s3 checked the broker port against the filer, metrics,
read-only, WebDAV, IAM and SFTP ports but not -debug.port, which the
debug server binds before the broker starts. weed server already
includes it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 authored and GitHub committed 2026-12-01 15:33:00 -08:00
1 parent 52afabbf1b
commit 04bbf1ae0f
2 files changed
+12 -4

No files matched your search

+3
View File
@@ -59,6 +59,9 @@ func filerRunsMqBrokerBesideS3(brokerFlagPassed bool) bool {
// filer starts with its gateway, derived gRPC ports included.
func filerPortsBesideS3() []int {
ports := append([]int{*f.metricsHttpPort}, withGrpc(f.port, f.portGrpc)...)
if *f.debug {
ports = append(ports, *f.debugPort)
}
if *f.publicPort != 0 {
ports = append(ports, *f.publicPort)
}
+9 -4
View File
@@ -39,23 +39,28 @@ func TestFilerRunsMqBrokerOnlyBesideS3(t *testing.T) {
})
}
// weed filer -s3 -webdav -webdav.port=17777, and weed filer -port=7777 -s3
// whose filer gRPC port is 17777.
// weed filer -s3 -webdav -webdav.port=17777, weed filer -port=7777 -s3
// whose filer gRPC port is 17777, and weed filer -s3 -debug -debug.port=17777.
func TestFilerDefaultBrokerYieldsToFilerProcessPorts(t *testing.T) {
port, portGrpc, webdav, webdavPort := *f.port, *f.portGrpc, *filerStartWebDav, *filerWebDavOptions.port
debug, debugPort := *f.debug, *f.debugPort
t.Cleanup(func() {
*f.port, *f.portGrpc, *filerStartWebDav, *filerWebDavOptions.port = port, portGrpc, webdav, webdavPort
*f.debug, *f.debugPort = debug, debugPort
})
for _, tc := range []struct {
name string
filerPort, webdavPort int
webdav bool
debugPort int
}{
{"-webdav.port on the broker port", 8888, 17777, true},
{"-port whose derived gRPC port is the broker's", 7777, 7333, false},
{"-webdav.port on the broker port", 8888, 17777, true, 0},
{"-port whose derived gRPC port is the broker's", 7777, 7333, false, 0},
{"-debug.port on the broker port", 8888, 7333, false, 17777},
} {
t.Run(tc.name, func(t *testing.T) {
*f.port, *f.portGrpc, *filerStartWebDav, *filerWebDavOptions.port = tc.filerPort, 0, tc.webdav, tc.webdavPort
*f.debug, *f.debugPort = tc.debugPort != 0, tc.debugPort
s3opt := gatewayWithBroker(8333, 0, 17777)
if err := s3opt.checkMqBrokerPort("s3.mq.broker.port", false, filerPortsBesideS3()...); err != nil || s3opt.mqBroker != nil {
t.Fatalf("default broker on a filer process port: err %v, broker kept %v", err, s3opt.mqBroker != nil)