(t *testing.T)
| 162 | } |
| 163 | |
| 164 | func TestUntilErrorCondition(t *testing.T) { |
| 165 | fw := watch.NewFake() |
| 166 | go func() { |
| 167 | var obj *fakePod |
| 168 | fw.Add(obj) |
| 169 | }() |
| 170 | expected := "something bad" |
| 171 | conditions := []ConditionFunc{ |
| 172 | func(event watch.Event) (bool, error) { return event.Type == watch.Added, nil }, |
| 173 | func(event watch.Event) (bool, error) { return false, errors.New(expected) }, |
| 174 | } |
| 175 | |
| 176 | ctx, cancel := context.WithTimeout(context.Background(), time.Minute) |
| 177 | defer cancel() |
| 178 | |
| 179 | _, err := UntilWithoutRetry(ctx, fw, conditions...) |
| 180 | if err == nil { |
| 181 | t.Fatal("expected an error") |
| 182 | } |
| 183 | if !strings.Contains(err.Error(), expected) { |
| 184 | t.Fatalf("expected %q in error string, got %q", expected, err.Error()) |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | func TestUntilWithSync(t *testing.T) { |
| 189 | // FIXME: test preconditions |
nothing calls this directly
no test coverage detected