func aggregate(request *cocaine.Request, response *cocaine.Response) { defer response.Close() raw := <-request.Read() name := string(raw) if data, err := configmanager.GetAggregateCfg(name); err != nil { response.ErrorMsg(-2, fmt.Sprintf("Missing file with name %s", name)) } else { response.Write(data) } }
func TestAggregate(t *testing.T) { var m AggConfig data, err := configmanager.GetAggregateCfg("http_ok.yaml") if err != nil { t.Fatal(err) } err = goyaml.Unmarshal(data, &m) if err != nil { t.Fatal(err) } fmt.Println(len(m.Data)) fmt.Println(len(m.Senders)) t.Log(m) }