@@ -229,6 +229,24 @@ func TestWaitUntilReady_ReturnsErrorOnTimeout(t *testing.T) {
229229 }
230230}
231231
232+ func TestWaitUntilReady_ReturnsErrorWhenWatchFails (t * testing.T ) {
233+ strimziClient := strimzifake .NewSimpleClientset ()
234+ wantErr := errors .New ("watch failed" )
235+
236+ strimziClient .PrependWatchReactor ("kafkas" , func (action k8stesting.Action ) (bool , watch.Interface , error ) {
237+ return true , nil , wantErr
238+ })
239+
240+ _ , err := waitUntilReady (strimziClient , "my-cluster" , "ns" , 10 )
241+ if err == nil {
242+ t .Fatal ("expected watch error, got nil" )
243+ }
244+
245+ if ! errors .Is (err , wantErr ) {
246+ t .Fatalf ("expected %v, got %v" , wantErr , err )
247+ }
248+ }
249+
232250func TestWaitUntilReconciliationPaused_ReturnsTrueWhenPausedEventArrives (t * testing.T ) {
233251 strimziClient := strimzifake .NewSimpleClientset ()
234252 fakeWatch := watch .NewFake ()
@@ -301,6 +319,24 @@ func TestWaitUntilReconciliationPaused_ReturnsErrorOnTimeout(t *testing.T) {
301319 }
302320}
303321
322+ func TestWaitUntilReconciliationPaused_ReturnsErrorWhenWatchFails (t * testing.T ) {
323+ strimziClient := strimzifake .NewSimpleClientset ()
324+ wantErr := errors .New ("watch failed" )
325+
326+ strimziClient .PrependWatchReactor ("kafkas" , func (action k8stesting.Action ) (bool , watch.Interface , error ) {
327+ return true , nil , wantErr
328+ })
329+
330+ _ , err := waitUntilReconciliationPaused (strimziClient , "my-cluster" , "ns" , 10 )
331+ if err == nil {
332+ t .Fatal ("expected watch error, got nil" )
333+ }
334+
335+ if ! errors .Is (err , wantErr ) {
336+ t .Fatalf ("expected %v, got %v" , wantErr , err )
337+ }
338+ }
339+
304340func TestWaitForPodSetPodsDeletion_ReturnsNilWhenNoPodsExist (t * testing.T ) {
305341 kube := k8sfake .NewSimpleClientset ()
306342
0 commit comments