mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 17:51:21 +00:00
Review feedback.
This commit is contained in:
@@ -47,15 +47,9 @@ func MapEndpointIdentity(m RenderableNode, local report.Networks) RenderableNode
|
||||
return RenderableNodes{}
|
||||
}
|
||||
|
||||
// We need to filter out short lived connections from this view,
|
||||
// if they don't also have a pid; see #447. Note if they
|
||||
// we're introduced by proc spy then they are guaranteed to
|
||||
// have a pid on the other end of the adjacency, so we include them
|
||||
// no matter what.
|
||||
pid, pidOK := m.Metadata[process.PID]
|
||||
_, conntracked := m.Metadata[endpoint.Conntracked]
|
||||
// We only show nodes found through procspy in this view.
|
||||
_, procspied := m.Metadata[endpoint.Procspied]
|
||||
if !procspied && !pidOK && conntracked {
|
||||
if !procspied {
|
||||
return RenderableNodes{}
|
||||
}
|
||||
|
||||
@@ -93,6 +87,7 @@ func MapEndpointIdentity(m RenderableNode, local report.Networks) RenderableNode
|
||||
rank = major
|
||||
)
|
||||
|
||||
pid, pidOK := m.Metadata[process.PID]
|
||||
if pidOK {
|
||||
minor = fmt.Sprintf("%s (%s)", minor, pid)
|
||||
}
|
||||
|
||||
@@ -18,11 +18,11 @@ func nrn(nmd report.Node) render.RenderableNode {
|
||||
func TestMapEndpointIdentity(t *testing.T) {
|
||||
for _, input := range []testcase{
|
||||
{nrn(report.MakeNode()), false},
|
||||
{nrn(report.MakeNodeWith(map[string]string{endpoint.Addr: "1.2.3.4"})), false},
|
||||
{nrn(report.MakeNodeWith(map[string]string{endpoint.Port: "1234"})), false},
|
||||
{nrn(report.MakeNodeWith(map[string]string{endpoint.Addr: "1.2.3.4", endpoint.Port: "1234"})), true},
|
||||
{nrn(report.MakeNodeWith(map[string]string{endpoint.Addr: "1.2.3.4", endpoint.Port: "40000"})), true},
|
||||
{nrn(report.MakeNodeWith(map[string]string{report.HostNodeID: report.MakeHostNodeID("foo"), endpoint.Addr: "10.0.0.1", endpoint.Port: "20001"})), true},
|
||||
{nrn(report.MakeNodeWith(map[string]string{endpoint.Addr: "1.2.3.4", endpoint.Procspied: "true"})), false},
|
||||
{nrn(report.MakeNodeWith(map[string]string{endpoint.Port: "1234", endpoint.Procspied: "true"})), false},
|
||||
{nrn(report.MakeNodeWith(map[string]string{endpoint.Addr: "1.2.3.4", endpoint.Port: "1234", endpoint.Procspied: "true"})), true},
|
||||
{nrn(report.MakeNodeWith(map[string]string{endpoint.Addr: "1.2.3.4", endpoint.Port: "40000", endpoint.Procspied: "true"})), true},
|
||||
{nrn(report.MakeNodeWith(map[string]string{report.HostNodeID: report.MakeHostNodeID("foo"), endpoint.Addr: "10.0.0.1", endpoint.Port: "20001", endpoint.Procspied: "true"})), true},
|
||||
} {
|
||||
testMap(t, render.MapEndpointIdentity, input)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user