(t *testing.T)
| 355 | } |
| 356 | |
| 357 | func TestReflectorResync(t *testing.T) { |
| 358 | iteration := 0 |
| 359 | stopCh := make(chan struct{}) |
| 360 | rerr := errors.New("expected resync reached") |
| 361 | s := &FakeCustomStore{ |
| 362 | ResyncFunc: func() error { |
| 363 | iteration++ |
| 364 | if iteration == 2 { |
| 365 | return rerr |
| 366 | } |
| 367 | return nil |
| 368 | }, |
| 369 | } |
| 370 | |
| 371 | lw := &testLW{ |
| 372 | WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { |
| 373 | fw := watch.NewFake() |
| 374 | return fw, nil |
| 375 | }, |
| 376 | ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { |
| 377 | return &v1.PodList{ListMeta: metav1.ListMeta{ResourceVersion: "0"}}, nil |
| 378 | }, |
| 379 | } |
| 380 | resyncPeriod := 1 * time.Millisecond |
| 381 | r := NewReflector(lw, &v1.Pod{}, s, resyncPeriod) |
| 382 | if err := r.ListAndWatch(stopCh); err != nil { |
| 383 | // error from Resync is not propaged up to here. |
| 384 | t.Errorf("expected error %v", err) |
| 385 | } |
| 386 | if iteration != 2 { |
| 387 | t.Errorf("exactly 2 iterations were expected, got: %v", iteration) |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | func TestReflectorWatchListPageSize(t *testing.T) { |
| 392 | stopCh := make(chan struct{}) |
nothing calls this directly
no test coverage detected