mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-07-24 00:53:05 +00:00
* Respect filerGroup in admin discovery Admin discovery previously queried master cluster nodes with an empty filer group, so filers registered under a non-default group could not appear in the admin UI. Add an admin filerGroup flag and carry it through cluster-node discovery requests while preserving the empty default behavior. Constraint: SeaweedFS master ListClusterNodes filters by exact filer_group. Rejected: Discover all groups implicitly | no existing admin or shell behavior exposes cross-group discovery. Confidence: high Scope-risk: narrow Directive: Keep admin cluster discovery scoped to the configured filerGroup unless an explicit all-groups API is added. Tested: docker run --rm -v "$PWD:/src" -w /src golang:1.25 go test ./weed/admin/dash -run TestListClusterNodesRequest -count=1 Tested: docker run --rm -v "$PWD:/src" -w /src golang:1.25 go test ./weed/command -run '^$' -count=1 Not-tested: full repository test suite * mini: pass filer group to admin cluster discovery miniAdminOptions.filerGroup was never initialized, so startAdminServer dereferenced a nil *string. Share the filer.filerGroup flag pointer so the co-located admin queries the same group the filer registers under. --------- Co-authored-by: Chris Lu <chris.lu@gmail.com>
31 lines
739 B
Go
31 lines
739 B
Go
package dash
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/seaweedfs/seaweedfs/weed/cluster"
|
|
)
|
|
|
|
func TestListClusterNodesRequestIncludesFilerGroup(t *testing.T) {
|
|
server := &AdminServer{filerGroup: "tenant-a"}
|
|
|
|
req := server.listClusterNodesRequest(cluster.FilerType)
|
|
|
|
if req.ClientType != cluster.FilerType {
|
|
t.Fatalf("ClientType = %q, want %q", req.ClientType, cluster.FilerType)
|
|
}
|
|
if req.FilerGroup != "tenant-a" {
|
|
t.Fatalf("FilerGroup = %q, want %q", req.FilerGroup, "tenant-a")
|
|
}
|
|
}
|
|
|
|
func TestListClusterNodesRequestKeepsDefaultFilerGroupEmpty(t *testing.T) {
|
|
server := &AdminServer{}
|
|
|
|
req := server.listClusterNodesRequest(cluster.FilerType)
|
|
|
|
if req.FilerGroup != "" {
|
|
t.Fatalf("FilerGroup = %q, want empty", req.FilerGroup)
|
|
}
|
|
}
|