(t *testing.T)
| 101 | } |
| 102 | |
| 103 | func TestUntilMultipleConditionsFail(t *testing.T) { |
| 104 | fw := watch.NewFake() |
| 105 | go func() { |
| 106 | var obj *fakePod |
| 107 | fw.Add(obj) |
| 108 | }() |
| 109 | conditions := []ConditionFunc{ |
| 110 | func(event watch.Event) (bool, error) { return event.Type == watch.Added, nil }, |
| 111 | func(event watch.Event) (bool, error) { return event.Type == watch.Added, nil }, |
| 112 | func(event watch.Event) (bool, error) { return event.Type == watch.Deleted, nil }, |
| 113 | } |
| 114 | |
| 115 | ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) |
| 116 | defer cancel() |
| 117 | |
| 118 | lastEvent, err := UntilWithoutRetry(ctx, fw, conditions...) |
| 119 | if err != wait.ErrWaitTimeout { |
| 120 | t.Fatalf("expected ErrWaitTimeout error, got %#v", err) |
| 121 | } |
| 122 | if lastEvent == nil { |
| 123 | t.Fatal("expected an event") |
| 124 | } |
| 125 | if lastEvent.Type != watch.Added { |
| 126 | t.Fatalf("expected ADDED event type, got %v", lastEvent.Type) |
| 127 | } |
| 128 | if got, isPod := lastEvent.Object.(*fakePod); !isPod { |
| 129 | t.Fatalf("expected a pod event, got %#v", got) |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | func TestUntilTimeout(t *testing.T) { |
| 134 | fw := watch.NewFake() |
nothing calls this directly
no test coverage detected