(t *testing.T)
| 103 | } |
| 104 | |
| 105 | func TestEventf(t *testing.T) { |
| 106 | testPod := &v1.Pod{ |
| 107 | ObjectMeta: metav1.ObjectMeta{ |
| 108 | SelfLink: "/api/version/pods/foo", |
| 109 | Name: "foo", |
| 110 | Namespace: "baz", |
| 111 | UID: "bar", |
| 112 | }, |
| 113 | } |
| 114 | testPod2 := &v1.Pod{ |
| 115 | ObjectMeta: metav1.ObjectMeta{ |
| 116 | SelfLink: "/api/version/pods/foo", |
| 117 | Name: "foo", |
| 118 | Namespace: "baz", |
| 119 | UID: "differentUid", |
| 120 | }, |
| 121 | } |
| 122 | testRef, err := ref.GetPartialReference(scheme.Scheme, testPod, "spec.containers[2]") |
| 123 | if err != nil { |
| 124 | t.Fatal(err) |
| 125 | } |
| 126 | testRef2, err := ref.GetPartialReference(scheme.Scheme, testPod2, "spec.containers[3]") |
| 127 | if err != nil { |
| 128 | t.Fatal(err) |
| 129 | } |
| 130 | table := []struct { |
| 131 | obj k8sruntime.Object |
| 132 | eventtype string |
| 133 | reason string |
| 134 | messageFmt string |
| 135 | elements []interface{} |
| 136 | expect *v1.Event |
| 137 | expectLog string |
| 138 | expectUpdate bool |
| 139 | }{ |
| 140 | { |
| 141 | obj: testRef, |
| 142 | eventtype: v1.EventTypeNormal, |
| 143 | reason: "Started", |
| 144 | messageFmt: "some verbose message: %v", |
| 145 | elements: []interface{}{1}, |
| 146 | expect: &v1.Event{ |
| 147 | ObjectMeta: metav1.ObjectMeta{ |
| 148 | Name: "foo", |
| 149 | Namespace: "baz", |
| 150 | }, |
| 151 | InvolvedObject: v1.ObjectReference{ |
| 152 | Kind: "Pod", |
| 153 | Name: "foo", |
| 154 | Namespace: "baz", |
| 155 | UID: "bar", |
| 156 | APIVersion: "version", |
| 157 | FieldPath: "spec.containers[2]", |
| 158 | }, |
| 159 | Reason: "Started", |
| 160 | Message: "some verbose message: 1", |
| 161 | Source: v1.EventSource{Component: "eventTest"}, |
| 162 | Count: 1, |
nothing calls this directly
no test coverage detected