Update topology to include tag

Tag can be used to specify the sub-shape for the given node.

Signed-off-by: Akash Srivastava <akash.srivastava@openebs.io>
This commit is contained in:
Akash Srivastava
2018-10-16 01:04:42 +05:30
parent fdd3c4f147
commit ea9ad0a1e6
7 changed files with 44 additions and 0 deletions
+3
View File
@@ -48,6 +48,7 @@ func TestMakeDetailedHostNode(t *testing.T) {
Rank: "hostname.com",
Pseudo: false,
Shape: "circle",
Tag: "",
},
Adjacency: report.MakeIDList(fixture.ServerHostNodeID),
Metadata: []report.MetadataRow{
@@ -192,6 +193,7 @@ func TestMakeDetailedContainerNode(t *testing.T) {
LabelMinor: "server.hostname.com",
Rank: fixture.ServerContainerImageName,
Shape: "hexagon",
Tag: "",
Pseudo: false,
},
Metadata: []report.MetadataRow{
@@ -321,6 +323,7 @@ func TestMakeDetailedPodNode(t *testing.T) {
LabelMinor: "1 container",
Rank: "ping/pong-b",
Shape: "heptagon",
Tag: "",
Pseudo: false,
},
Metadata: []report.MetadataRow{
+3
View File
@@ -49,6 +49,7 @@ type BasicNodeSummary struct {
LabelMinor string `json:"labelMinor"`
Rank string `json:"rank"`
Shape string `json:"shape,omitempty"`
Tag string `json:"tag,omitempty"`
Stack bool `json:"stack,omitempty"`
Pseudo bool `json:"pseudo,omitempty"`
}
@@ -115,6 +116,7 @@ func MakeBasicNodeSummary(r report.Report, n report.Node) (BasicNodeSummary, boo
}
if t, ok := r.Topology(n.Topology); ok {
summary.Shape = t.GetShape()
summary.Tag = t.Tag
}
// Do we have a renderer for the topology?
@@ -399,6 +401,7 @@ func groupNodeSummary(base BasicNodeSummary, r report.Report, n report.Node) Bas
if topology, _, ok := render.ParseGroupNodeTopology(n.Topology); ok {
if t, ok := r.Topology(topology); ok {
base.Shape = t.GetShape()
base.Tag = t.Tag
if t.Label != "" {
base.LabelMinor = pluralize(n.Counters, topology, t.Label, t.LabelPlural)
}
+5
View File
@@ -110,6 +110,7 @@ func TestMakeNodeSummary(t *testing.T) {
LabelMinor: "client.hostname.com (10001)",
Rank: fixture.Client1Name,
Shape: "square",
Tag: "",
},
Metadata: []report.MetadataRow{
{ID: process.PID, Label: "PID", Value: fixture.Client1PID, Priority: 1, Datatype: report.Number},
@@ -128,6 +129,7 @@ func TestMakeNodeSummary(t *testing.T) {
LabelMinor: fixture.ClientHostName,
Rank: fixture.ClientContainerImageName,
Shape: "hexagon",
Tag: "",
},
Metadata: []report.MetadataRow{
{ID: docker.ImageName, Label: "Image name", Value: fixture.ClientContainerImageName, Priority: 2},
@@ -147,6 +149,7 @@ func TestMakeNodeSummary(t *testing.T) {
LabelMinor: "1 container",
Rank: fixture.ClientContainerImageName,
Shape: "hexagon",
Tag: "",
Stack: true,
},
Metadata: []report.MetadataRow{
@@ -166,6 +169,7 @@ func TestMakeNodeSummary(t *testing.T) {
LabelMinor: "hostname.com",
Rank: "hostname.com",
Shape: "circle",
Tag: "",
},
Metadata: []report.MetadataRow{
{ID: host.HostName, Label: "Hostname", Value: fixture.ClientHostName, Priority: 11},
@@ -184,6 +188,7 @@ func TestMakeNodeSummary(t *testing.T) {
LabelMinor: "1 process",
Rank: "apache",
Shape: "square",
Tag: "",
Stack: true,
},
},