package topology import ( "fmt" "testing" ) func TestLoadConfiguration(t *testing.T) { confContent := ` 192.168.1.1 192.168.1.2 192.168.1.3 192.168.1.4 ` c, err := NewConfiguration([]byte(confContent)) fmt.Printf("%s\n", c) if err != nil { t.Fatalf("unmarshal error:%v", err) } if len(c.Topo.DataCenters) <= 0 || c.Topo.DataCenters[0].Name != "dc1" { t.Fatalf("unmarshal error:%s", c) } }