Skip to content

Commit 06acde3

Browse files
terinjokesk8s-infra-cherrypick-robot
authored and
k8s-infra-cherrypick-robot
committed
🐛 correct kind source type
Reverse the nil check in the String function of the internal Kind source to print the type when known. Fixes: 2add01e ("Event, source, handler, predicates: Use generics") Signed-off-by: Terin Stock <[email protected]>
1 parent d6feaae commit 06acde3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pkg/internal/source/internal_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,15 @@ var _ = Describe("Internal", func() {
286286
instance.OnDelete(Foo{})
287287
})
288288
})
289+
290+
Describe("Kind", func() {
291+
It("should return kind source type", func() {
292+
kind := internal.Kind[*corev1.Pod]{
293+
Type: &corev1.Pod{},
294+
}
295+
Expect(kind.String()).Should(Equal("kind source: *v1.Pod"))
296+
})
297+
})
289298
})
290299

291300
type Foo struct{}

pkg/internal/source/kind.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func (ks *Kind[T]) Start(ctx context.Context, queue workqueue.RateLimitingInterf
103103
}
104104

105105
func (ks *Kind[T]) String() string {
106-
if isNil(ks.Type) {
106+
if !isNil(ks.Type) {
107107
return fmt.Sprintf("kind source: %T", ks.Type)
108108
}
109109
return "kind source: unknown type"

0 commit comments

Comments
 (0)