(t *testing.T)
| 131 | } |
| 132 | |
| 133 | func TestUntilTimeout(t *testing.T) { |
| 134 | fw := watch.NewFake() |
| 135 | go func() { |
| 136 | var obj *fakePod |
| 137 | fw.Add(obj) |
| 138 | fw.Modify(obj) |
| 139 | }() |
| 140 | conditions := []ConditionFunc{ |
| 141 | func(event watch.Event) (bool, error) { |
| 142 | return event.Type == watch.Added, nil |
| 143 | }, |
| 144 | func(event watch.Event) (bool, error) { |
| 145 | return event.Type == watch.Modified, nil |
| 146 | }, |
| 147 | } |
| 148 | |
| 149 | lastEvent, err := UntilWithoutRetry(context.Background(), fw, conditions...) |
| 150 | if err != nil { |
| 151 | t.Fatalf("expected nil error, got %#v", err) |
| 152 | } |
| 153 | if lastEvent == nil { |
| 154 | t.Fatal("expected an event") |
| 155 | } |
| 156 | if lastEvent.Type != watch.Modified { |
| 157 | t.Fatalf("expected MODIFIED event type, got %v", lastEvent.Type) |
| 158 | } |
| 159 | if got, isPod := lastEvent.Object.(*fakePod); !isPod { |
| 160 | t.Fatalf("expected a pod event, got %#v", got) |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | func TestUntilErrorCondition(t *testing.T) { |
| 165 | fw := watch.NewFake() |
nothing calls this directly
no test coverage detected