@@ -45,15 +45,36 @@ func TestMergeEventsNilNodeEvents(t *testing.T) {
4545 key := "Events"
4646
4747 metadataNode1 := graph.Metadata {key : map [string ]interface {}{
48- "abc" : map [string ]string {"descr" : "foo" },
48+ "abc" : map [interface {} ]string {"descr" : "foo" },
4949 }}
5050 node := CreateNode ("nodeA" , metadataNode1 , graph .TimeUTC (), 1 )
5151
5252 nodeEventsAgg := mergeEvents (node , key , nil )
5353
54- expected := map [string ][]interface {}{
54+ expected := map [interface {} ][]interface {}{
5555 "abc" : {
56- map [string ]string {"descr" : "foo" },
56+ map [interface {}]string {"descr" : "foo" },
57+ },
58+ }
59+
60+ assert .Equal (t , expected , nodeEventsAgg )
61+ }
62+
63+ func TestMergeEventsPointerValue (t * testing.T ) {
64+ key := "Events"
65+
66+ value := map [string ]interface {}{
67+ "abc" : map [interface {}]string {"descr" : "foo" },
68+ }
69+
70+ metadataNode1 := graph.Metadata {key : & value }
71+ node := CreateNode ("nodeA" , metadataNode1 , graph .TimeUTC (), 1 )
72+
73+ nodeEventsAgg := mergeEvents (node , key , nil )
74+
75+ expected := map [interface {}][]interface {}{
76+ "abc" : {
77+ map [interface {}]string {"descr" : "foo" },
5778 },
5879 }
5980
@@ -64,19 +85,19 @@ func TestMergeEvents(t *testing.T) {
6485 tests := []struct {
6586 name string
6687 nodesEvents []interface {}
67- expected map [string ][]interface {}
88+ expected map [interface {} ][]interface {}
6889 }{
6990 {
7091 name : "no nodes" ,
71- expected : map [string ][]interface {}{},
92+ expected : map [interface {} ][]interface {}{},
7293 },
7394 {
7495 name : "one node" ,
7596 nodesEvents : []interface {}{
7697 map [string ]interface {}{
7798 "abc" : map [string ]string {"descr" : "foo" },
7899 }},
79- expected : map [string ][]interface {}{
100+ expected : map [interface {} ][]interface {}{
80101 "abc" : {
81102 map [string ]string {"descr" : "foo" },
82103 },
@@ -91,7 +112,7 @@ func TestMergeEvents(t *testing.T) {
91112 map [string ]interface {}{
92113 "xyz" : map [string ]string {"descr" : "bar" },
93114 }},
94- expected : map [string ][]interface {}{
115+ expected : map [interface {} ][]interface {}{
95116 "abc" : {
96117 map [string ]string {"descr" : "foo" },
97118 },
@@ -109,7 +130,7 @@ func TestMergeEvents(t *testing.T) {
109130 map [string ]interface {}{
110131 "abc" : map [string ]string {"descr" : "bar" },
111132 }},
112- expected : map [string ][]interface {}{
133+ expected : map [interface {} ][]interface {}{
113134 "abc" : {
114135 map [string ]string {"descr" : "foo" },
115136 map [string ]string {"descr" : "bar" },
@@ -126,7 +147,7 @@ func TestMergeEvents(t *testing.T) {
126147 "abc" : map [string ]string {"descr" : "foo" },
127148 "xxx" : map [string ]string {"descr" : "bar" },
128149 }},
129- expected : map [string ][]interface {}{
150+ expected : map [interface {} ][]interface {}{
130151 "abc" : {
131152 map [string ]string {"descr" : "foo" },
132153 },
@@ -141,7 +162,7 @@ func TestMergeEvents(t *testing.T) {
141162
142163 for _ , test := range tests {
143164 t .Run (test .name , func (t * testing.T ) {
144- nodeEventsAgg := map [string ][]interface {}{}
165+ nodeEventsAgg := map [interface {} ][]interface {}{}
145166
146167 for _ , nodeEvents := range test .nodesEvents {
147168 metadataNode1 := graph.Metadata {key : nodeEvents }
0 commit comments