@@ -50,7 +50,7 @@ func TestGetAttrs(t *testing.T) {
50
50
Type : api .EventTypeNormal ,
51
51
}
52
52
field := ToSelectableFields (eventA )
53
- expect := fields.Set {
53
+ expectA := fields.Set {
54
54
"metadata.name" : "f0118" ,
55
55
"metadata.namespace" : "default" ,
56
56
"involvedObject.kind" : "Pod" ,
@@ -61,10 +61,49 @@ func TestGetAttrs(t *testing.T) {
61
61
"involvedObject.resourceVersion" : "0" ,
62
62
"involvedObject.fieldPath" : "" ,
63
63
"reason" : "ForTesting" ,
64
+ "reportingComponent" : "" ,
64
65
"source" : "test" ,
65
66
"type" : api .EventTypeNormal ,
66
67
}
67
- if e , a := expect , field ; ! reflect .DeepEqual (e , a ) {
68
+ if e , a := expectA , field ; ! reflect .DeepEqual (e , a ) {
69
+ t .Errorf ("diff: %s" , diff .ObjectDiff (e , a ))
70
+ }
71
+
72
+ eventB := & api.Event {
73
+ ObjectMeta : metav1.ObjectMeta {
74
+ Name : "f0118" ,
75
+ Namespace : "default" ,
76
+ },
77
+ InvolvedObject : api.ObjectReference {
78
+ Kind : "Pod" ,
79
+ Name : "foo" ,
80
+ Namespace : "baz" ,
81
+ UID : "long uid string" ,
82
+ APIVersion : "v1" ,
83
+ ResourceVersion : "0" ,
84
+ FieldPath : "" ,
85
+ },
86
+ Reason : "ForTesting" ,
87
+ ReportingController : "test" ,
88
+ Type : api .EventTypeNormal ,
89
+ }
90
+ field = ToSelectableFields (eventB )
91
+ expectB := fields.Set {
92
+ "metadata.name" : "f0118" ,
93
+ "metadata.namespace" : "default" ,
94
+ "involvedObject.kind" : "Pod" ,
95
+ "involvedObject.name" : "foo" ,
96
+ "involvedObject.namespace" : "baz" ,
97
+ "involvedObject.uid" : "long uid string" ,
98
+ "involvedObject.apiVersion" : "v1" ,
99
+ "involvedObject.resourceVersion" : "0" ,
100
+ "involvedObject.fieldPath" : "" ,
101
+ "reason" : "ForTesting" ,
102
+ "reportingComponent" : "test" ,
103
+ "source" : "test" ,
104
+ "type" : api .EventTypeNormal ,
105
+ }
106
+ if e , a := expectB , field ; ! reflect .DeepEqual (e , a ) {
68
107
t .Errorf ("diff: %s" , diff .ObjectDiff (e , a ))
69
108
}
70
109
}
0 commit comments