func TestReduceEdge(t *testing.T) { renderer := render.Reduce([]render.Renderer{ mockRenderer{edgeMetadata: report.EdgeMetadata{EgressPacketCount: newu64(1)}}, mockRenderer{edgeMetadata: report.EdgeMetadata{EgressPacketCount: newu64(2)}}, }) want := report.EdgeMetadata{EgressPacketCount: newu64(3)} have := renderer.EdgeMetadata(report.MakeReport(), "", "") if !reflect.DeepEqual(want, have) { t.Errorf("want %+v, have %+v", want, have) } }
func TestReduceEdge(t *testing.T) { renderer := render.Reduce([]render.Renderer{ mockRenderer{aggregateMetadata: render.AggregateMetadata{"foo": 1}}, mockRenderer{aggregateMetadata: render.AggregateMetadata{"bar": 2}}, }) want := render.AggregateMetadata{"foo": 1, "bar": 2} have := renderer.AggregateMetadata(report.MakeReport(), "", "") if !reflect.DeepEqual(want, have) { t.Errorf("want %+v, have %+v", want, have) } }
func TestReduceRender(t *testing.T) { renderer := render.Reduce([]render.Renderer{ mockRenderer{RenderableNodes: render.RenderableNodes{"foo": {ID: "foo"}}}, mockRenderer{RenderableNodes: render.RenderableNodes{"bar": {ID: "bar"}}}, }) want := render.RenderableNodes{"foo": {ID: "foo"}, "bar": {ID: "bar"}} have := renderer.Render(report.MakeReport()) if !reflect.DeepEqual(want, have) { t.Errorf("want %+v, have %+v", want, have) } }
func TestReduceRender(t *testing.T) { renderer := render.Reduce([]render.Renderer{ mockRenderer{Nodes: report.Nodes{"foo": report.MakeNode("foo")}}, mockRenderer{Nodes: report.Nodes{"bar": report.MakeNode("bar")}}, }) want := report.Nodes{ "foo": report.MakeNode("foo"), "bar": report.MakeNode("bar"), } have := renderer.Render(report.MakeReport(), FilterNoop) if !reflect.DeepEqual(want, have) { t.Errorf("want %+v, have %+v", want, have) } }