MCPcopy
hub / github.com/kubernetes/client-go / TestEventSeriesf

Function TestEventSeriesf

tools/events/eventseries_test.go:66–179  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

64}
65
66func TestEventSeriesf(t *testing.T) {
67 hostname, _ := os.Hostname()
68
69 testPod := &v1.Pod{
70 ObjectMeta: metav1.ObjectMeta{
71 SelfLink: "/api/version/pods/foo",
72 Name: "foo",
73 Namespace: "baz",
74 UID: "bar",
75 },
76 }
77
78 regarding, err := ref.GetPartialReference(scheme.Scheme, testPod, ".spec.containers[1]")
79 if err != nil {
80 t.Fatal(err)
81 }
82
83 related, err := ref.GetPartialReference(scheme.Scheme, testPod, ".spec.containers[0]")
84 if err != nil {
85 t.Fatal(err)
86 }
87
88 expectedEvent := &v1beta1.Event{
89 ObjectMeta: metav1.ObjectMeta{
90 Name: "foo",
91 Namespace: "baz",
92 },
93 EventTime: metav1.MicroTime{time.Now()},
94 ReportingController: "eventTest",
95 ReportingInstance: "eventTest-" + hostname,
96 Action: "started",
97 Reason: "test",
98 Regarding: *regarding,
99 Related: related,
100 Note: "some verbose message: 1",
101 Type: v1.EventTypeNormal,
102 }
103
104 isomorphicEvent := expectedEvent.DeepCopy()
105
106 nonIsomorphicEvent := expectedEvent.DeepCopy()
107 nonIsomorphicEvent.Action = "stopped"
108
109 expectedEvent.Series = &v1beta1.EventSeries{Count: 1}
110 table := []struct {
111 regarding k8sruntime.Object
112 related k8sruntime.Object
113 actual *v1beta1.Event
114 elements []interface{}
115 expect *v1beta1.Event
116 expectUpdate bool
117 }{
118 {
119 regarding: regarding,
120 related: related,
121 actual: isomorphicEvent,
122 elements: []interface{}{1},
123 expect: expectedEvent,

Callers

nothing calls this directly

Calls 8

newBroadcasterFunction · 0.85
validateEventSerieFunction · 0.85
NowMethod · 0.65
DeepCopyMethod · 0.65
NewRecorderMethod · 0.65
StartRecordingToSinkMethod · 0.65
EventfMethod · 0.65
LogfMethod · 0.65

Tested by

no test coverage detected