Skip to content

Commit 00597ac

Browse files
committed
Remove unnecessary Status() intercept
1 parent cd8451c commit 00597ac

File tree

2 files changed

+0
-27
lines changed

2 files changed

+0
-27
lines changed

pkg/client/fake/intercept.go

-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ type InterceptorFns struct {
2929
Patch func(ctx context.Context, client client.WithWatch, obj client.Object, patch client.Patch, opts ...client.PatchOption) error
3030
Watch func(ctx context.Context, client client.WithWatch, obj client.ObjectList, opts ...client.ListOption) (watch.Interface, error)
3131
SubResource func(client client.WithWatch, subResource string) client.SubResourceClient
32-
Status func(client client.WithWatch) client.StatusWriter
3332
}
3433

3534
type interceptor struct {
@@ -97,9 +96,6 @@ func (c interceptor) DeleteAllOf(ctx context.Context, obj client.Object, opts ..
9796
}
9897

9998
func (c interceptor) Status() client.SubResourceWriter {
100-
if c.fns.Status != nil {
101-
return c.fns.Status(c.client)
102-
}
10399
return c.client.Status()
104100
}
105101

pkg/client/fake/intercept_test.go

-23
Original file line numberDiff line numberDiff line change
@@ -220,29 +220,6 @@ var _ = Describe("Interceptor", func() {
220220
_ = client2.SubResource("")
221221
Expect(called).To(BeTrue())
222222
})
223-
It("should call the provided Status function", func() {
224-
var called bool
225-
client := Interceptor(wrappedClient, InterceptorFns{
226-
Status: func(client client.WithWatch) client.StatusWriter {
227-
called = true
228-
return nil
229-
},
230-
})
231-
_ = client.Status()
232-
Expect(called).To(BeTrue())
233-
})
234-
It("should call the underlying client if the provided Status function is nil", func() {
235-
var called bool
236-
client1 := Interceptor(wrappedClient, InterceptorFns{
237-
Status: func(client client.WithWatch) client.StatusWriter {
238-
called = true
239-
return nil
240-
},
241-
})
242-
client2 := Interceptor(client1, InterceptorFns{})
243-
_ = client2.Status()
244-
Expect(called).To(BeTrue())
245-
})
246223
})
247224

248225
var _ = Describe("SubResourceInterceptor", func() {

0 commit comments

Comments
 (0)