(t *testing.T)
| 72 | } |
| 73 | |
| 74 | func TestUntilMultipleConditions(t *testing.T) { |
| 75 | fw := watch.NewFake() |
| 76 | go func() { |
| 77 | var obj *fakePod |
| 78 | fw.Add(obj) |
| 79 | }() |
| 80 | conditions := []ConditionFunc{ |
| 81 | func(event watch.Event) (bool, error) { return event.Type == watch.Added, nil }, |
| 82 | func(event watch.Event) (bool, error) { return event.Type == watch.Added, nil }, |
| 83 | } |
| 84 | |
| 85 | ctx, cancel := context.WithTimeout(context.Background(), time.Minute) |
| 86 | defer cancel() |
| 87 | |
| 88 | lastEvent, err := UntilWithoutRetry(ctx, fw, conditions...) |
| 89 | if err != nil { |
| 90 | t.Fatalf("expected nil error, got %#v", err) |
| 91 | } |
| 92 | if lastEvent == nil { |
| 93 | t.Fatal("expected an event") |
| 94 | } |
| 95 | if lastEvent.Type != watch.Added { |
| 96 | t.Fatalf("expected MODIFIED event type, got %v", lastEvent.Type) |
| 97 | } |
| 98 | if got, isPod := lastEvent.Object.(*fakePod); !isPod { |
| 99 | t.Fatalf("expected a pod event, got %#v", got) |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | func TestUntilMultipleConditionsFail(t *testing.T) { |
| 104 | fw := watch.NewFake() |
nothing calls this directly
no test coverage detected