mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 02:57:37 +01:00
A disk type with no free slots made cluster.check return before the default data center/rack warnings were printed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
832 B
Go
30 lines
832 B
Go
package shell
|
|
|
|
import (
|
|
"bytes"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
|
|
"github.com/seaweedfs/seaweedfs/weed/topology"
|
|
)
|
|
|
|
func TestPrintDefaultPlacementWarnings(t *testing.T) {
|
|
topo := &master_pb.TopologyInfo{
|
|
DataCenterInfos: []*master_pb.DataCenterInfo{
|
|
{Id: "dc1", RackInfos: []*master_pb.RackInfo{
|
|
{Id: "r1", DataNodeInfos: []*master_pb.DataNodeInfo{{Id: "10.0.0.1:8080"}}},
|
|
}},
|
|
{Id: topology.DefaultDataCenter, RackInfos: []*master_pb.RackInfo{
|
|
{Id: topology.DefaultRack, DataNodeInfos: []*master_pb.DataNodeInfo{{Id: "10.0.0.2:8080"}}},
|
|
}},
|
|
},
|
|
}
|
|
var buf bytes.Buffer
|
|
printDefaultPlacementWarnings(&buf, topo)
|
|
out := buf.String()
|
|
if strings.Count(out, "warning:") != 1 || !strings.Contains(out, "10.0.0.2:8080") {
|
|
t.Fatalf("unexpected output: %q", out)
|
|
}
|
|
}
|