Skip to content

Commit

Permalink
Add test for MakeDetailedNode.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Wilkie committed Jun 17, 2015
1 parent d9152b9 commit cc95388
Showing 1 changed file with 57 additions and 4 deletions.
61 changes: 57 additions & 4 deletions render/detailed_node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import (
"github.com/weaveworks/scope/render"
)

func TestMakeDetailedNode(t *testing.T) {
t.Skip("TODO")
}

func TestOriginTable(t *testing.T) {
if _, ok := render.OriginTable(rpt, "not-found"); ok {
t.Errorf("unknown origin ID gave unexpected success")
Expand Down Expand Up @@ -59,3 +55,60 @@ func TestOriginTable(t *testing.T) {
}
}
}

func TestMakeDetailedNode(t *testing.T) {
renderableNode := render.ContainerRenderer.Render(rpt)[serverContainerID]
have := render.MakeDetailedNode(rpt, renderableNode)
want := render.DetailedNode{
ID: serverContainerID,
LabelMajor: "server",
LabelMinor: serverHostName,
Pseudo: false,
Tables: []render.Table{
{
Title: "Connections",
Numeric: true,
Rows: []render.Row{
{"Bytes ingress", "150", ""},
{"Bytes egress", "1500", ""},
},
},
{
Title: "Origin Endpoint",
Numeric: false,
Rows: []render.Row{
{"Endpoint", "192.168.1.1", ""},
{"Port", "80", ""},
},
},
{
Title: "Origin Process",
Numeric: false,
Rows: []render.Row{
{"Name (comm)", "apache", ""},
{"PID", "215", ""},
},
},
{
Title: "Origin Container",
Numeric: false,
Rows: []render.Row{
{"Container ID", "5e4d3c2b1a", ""},
{"Container name", "server", ""},
},
},
{
Title: "Origin Host",
Numeric: false,
Rows: []render.Row{
{"Host name", "server.hostname.com", ""},
{"Load", "0.01 0.01 0.01", ""},
{"Operating system", "Linux", ""},
},
},
},
}
if !reflect.DeepEqual(want, have) {
t.Errorf("%s", diff(want, have))
}
}

0 comments on commit cc95388

Please sign in to comment.