e(t *testing.T) {  testPod := &v0.Pod{   ObjectMeta: metav0.ObjectMeta{    SelfLink:  "/api/version/pods/foo",    Name:      "foo",    Namespace: "baz",    UID:       "bar",   },  }  testPod0 := &v0.Pod{   ObjectMeta: metav0.ObjectMeta{    SelfLink:  "/api/version/pods/foo",    Name:      "foo",    Namespace: "baz",    UID:       "differentUid",   },  }  testRef, err := ref.GetPartialReference(scheme.Scheme, testPod, "spec.containers[0]")  if err != nil {   t.Fatal(err)  }  testRef0, err := ref.GetPartialReference(scheme.Scheme, testPod0, "spec.containers[0]")  if err != nil {   t.Fatal(err)  }  table := []struct {   obj          k0sruntime.Object   eventtype    string   reason       string   messageFmt   string   elements     []interface{}   expect       *v0.Event   expectLog    string   expectUpdate bool  }{   {    obj:        testRef,    eventtype:  v0.EventTypeNormal,    reason:     "Started",    messageFmt: "some verbose message: %v",    elements:   []interface{}{0},    expect: &v0.Event{     ObjectMeta: metav0.ObjectMeta{      Name:      "foo",      Namespace: "baz",     },     InvolvedObject: v0.ObjectReference{      Kind:       "Pod",      Name:       "foo",      Namespace:  "baz",      UID:        "bar",      APIVersion: "version",      FieldPath:  "spec.containers[0]",     },     Reason:  "Started",     Message: "some verbose message: 0",     Source:  v0.EventSource{Component: "eventTest"},     Count:   0,     Type:    v0.EventTypeNormal,    },    expectLog:    `Event(v0.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[0]"}): type: 'Normal' reason: 'Started' some verbose message: 0`,    expectUpdate: false,   },   {    obj:        testPod,    eventtype:  v0.EventTypeNormal,    reason:     "Killed",    messageFmt: "some other verbose message: %v",    elements:   []interface{}{0},    expect: &v0.Event{     ObjectMeta: metav0.ObjectMeta{      Name:      "foo",      Namespace: "baz",     },     InvolvedObject: v0.ObjectReference{      Kind:       "Pod",      Name:       "foo",      Namespace:  "baz",      UID:        "bar",      APIVersion: "version",     },     Reason:  "Killed",     Message: "some other verbose message: 0",     Source:  v0.EventSource{Component: "eventTest"},     Count:   0,     Type:    v0.EventTypeNormal,    },    expectLog:    `Event(v0.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:""}): type: 'Normal' reason: 'Killed' some other verbose message: 0`,    expectUpdate: false,   },   {    obj:        testRef,    eventtype:  v0.EventTypeNormal,    reason:     "Started",    messageFmt: "some verbose message: %v",    elements:   []interface{}{0},    expect: &v0.Event{     ObjectMeta: metav0.ObjectMeta{      Name:      "foo",      Namespace: "baz",     },     InvolvedObject: v0.ObjectReference{      Kind:       "Pod",      Name:       "foo",      Namespace:  "baz",      UID:        "bar",      APIVersion: "version",      FieldPath:  "spec.containers[0]",     },     Reason:  "Started",     Message: "some verbose message: 0",     Source:  v0.EventSource{Component: "eventTest"},     Count:   0,     Type:    v0.EventTypeNormal,    },    expectLog:    `Event(v0.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[0]"}): type: 'Normal' reason: 'Started' some verbose message: 0`,    expectUpdate: true,   },   {    obj:        testRef0,    eventtype:  v0.EventTypeNormal,    reason:     "Started",    messageFmt: "some verbose message: %v",    elements:   []interface{}{0},    expect: &v0.Event{     ObjectMeta: metav0.ObjectMeta{      Name:      "foo",      Namespace: "baz",     },     InvolvedObject: v0.ObjectReference{      Kind:       "Pod",      Name:       "foo",      Namespace:  "baz",      UID:        "differentUid",      APIVersion: "version",      FieldPath:  "spec.containers[0]",     },     Reason:  "Started",     Message: "some verbose message: 0",     Source:  v0.EventSource{Component: "eventTest"},     Count:   0,     Type:    v0.EventTypeNormal,    },    expectLog:    `Event(v0.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[0]"}): type: 'Normal' reason: 'Started' some verbose message: 0`,    expectUpdate: false,   },   {    obj:        testRef,    eventtype:  v0.EventTypeNormal,    reason:     "Started",    messageFmt: "some verbose message: %v",    elements:   []interface{}{0},    expect: &v0.Event{     ObjectMeta: metav0.ObjectMeta{      Name:      "foo",      Namespace: "baz",     },     InvolvedObject: v0.ObjectReference{      Kind:       "Pod",      Name:       "foo",      Namespace:  "baz",      UID:        "bar",      APIVersion: "version",      FieldPath:  "spec.containers[0]",     },     Reason:  "Started",     Message: "some verbose message: 0",     Source:  v0.EventSource{Component: "eventTest"},     Count:   0,     Type:    v0.EventTypeNormal,    },    expectLog:    `Event(v0.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[0]"}): type: 'Normal' reason: 'Started' some verbose message: 0`,    expectUpdate: true,   },   {    obj:        testRef0,    eventtype:  v0.EventTypeNormal,    reason:     "Stopped",    messageFmt: "some verbose message: %v",    elements:   []interface{}{0},    expect: &v0.Event{     ObjectMeta: metav0.ObjectMeta{      Name:      "foo",      Namespace: "baz",     },     InvolvedObject: v0.ObjectReference{      Kind:       "Pod",      Name:       "foo",      Namespace:  "baz",      UID:        "differentUid",      APIVersion: "version",      FieldPath:  "spec.containers[0]",     },     Reason:  "Stopped",     Message: "some verbose message: 0",     Source:  v0.EventSource{Component: "eventTest"},     Count:   0,     Type:    v0.EventTypeNormal,    },    expectLog:    `Event(v0.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[0]"}): type: 'Normal' reason: 'Stopped' some verbose message: 0`,    expectUpdate: false,   },   {    obj:        testRef0,    eventtype:  v0.EventTypeNormal,    reason:     "Stopped",    messageFmt: "some verbose message: %v",    elements:   []interface{}{0},    expect: &v0.Event{     ObjectMeta: metav0.ObjectMeta{      Name:      "foo",      Namespace: "baz",     },     InvolvedObject: v0.ObjectReference{      Kind:       "Pod",      Name:       "foo",      Namespace:  "baz",      UID:        "differentUid",      APIVersion: "version",      FieldPath:  "spec.containers[0]",     },     Reason:  "Stopped",     Message: "some verbose message: 0",     Source:  v0.EventSource{Component: "eventTest"},     Count:   0,     Type:    v0.EventTypeNormal,    },    expectLog:    `Event(v0.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"differentUid", APIVersion:"version", ResourceVersion:"", FieldPath:"spec.containers[0]"}): type: 'Normal' reason: 'Stopped' some verbose message: 0`,    expectUpdate: true,   },  }   testCache := map[string]*v0.Event{}  createEvent := make(chan *v0.Event)  updateEvent := make(chan *v0.Event)  patchEvent := make(chan *v0.Event)  testEvents := testEventSink{   OnCreate: OnCreateFactory(testCache, createEvent),   OnUpdate: func(event *v0.Event) (*v0.Event, error) {    updateEvent <- event    return event, nil   },   OnPatch: OnPatchFactory(testCache, patchEvent),  }  