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

Function TestMultiSinkCache

tools/record/event_test.go:629–924  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

627}
628
629func TestMultiSinkCache(t *testing.T) {
630 testPod := &v1.Pod{
631 ObjectMeta: metav1.ObjectMeta{
632 SelfLink: "/api/version/pods/foo",
633 Name: "foo",
634 Namespace: "baz",
635 UID: "bar",
636 },
637 }
638 testPod2 := &v1.Pod{
639 ObjectMeta: metav1.ObjectMeta{
640 SelfLink: "/api/version/pods/foo",
641 Name: "foo",
642 Namespace: "baz",
643 UID: "differentUid",
644 },
645 }
646 testRef, err := ref.GetPartialReference(scheme.Scheme, testPod, "spec.containers[2]")
647 if err != nil {
648 t.Fatal(err)
649 }
650 testRef2, err := ref.GetPartialReference(scheme.Scheme, testPod2, "spec.containers[3]")
651 if err != nil {
652 t.Fatal(err)
653 }
654 table := []struct {
655 obj k8sruntime.Object
656 eventtype string
657 reason string
658 messageFmt string
659 elements []interface{}
660 expect *v1.Event
661 expectLog string
662 expectUpdate bool
663 }{
664 {
665 obj: testRef,
666 eventtype: v1.EventTypeNormal,
667 reason: "Started",
668 messageFmt: "some verbose message: %v",
669 elements: []interface{}{1},
670 expect: &v1.Event{
671 ObjectMeta: metav1.ObjectMeta{
672 Name: "foo",
673 Namespace: "baz",
674 },
675 InvolvedObject: v1.ObjectReference{
676 Kind: "Pod",
677 Name: "foo",
678 Namespace: "baz",
679 UID: "bar",
680 APIVersion: "version",
681 FieldPath: "spec.containers[2]",
682 },
683 Reason: "Started",
684 Message: "some verbose message: 1",
685 Source: v1.EventSource{Component: "eventTest"},
686 Count: 1,

Callers

nothing calls this directly

Calls 9

OnCreateFactoryFunction · 0.85
OnPatchFactoryFunction · 0.85
NewBroadcasterForTestsFunction · 0.85
recorderWithFakeClockFunction · 0.85
validateEventFunction · 0.85
NowMethod · 0.65
StartRecordingToSinkMethod · 0.65
EventfMethod · 0.65
StopMethod · 0.65

Tested by

no test coverage detected