pkg/storage/etcd3: update test to time out, not panic
Without these select statements, this test runs until the package-global timeout and causes a panic. This change makes the test fail faster and more legibly. Signed-off-by: Steve Kuznetsov <skuznets@redhat.com> Kubernetes-commit: fc33d0176a5afb81927430d075165152f953c54e
This commit is contained in:
parent
5e6d6631a4
commit
25c879eec5
|
|
@ -299,9 +299,20 @@ func TestWatchDeleteEventObjectHaveLatestRV(t *testing.T) {
|
|||
t.Fatalf("Delete failed: %v", err)
|
||||
}
|
||||
|
||||
e := <-w.ResultChan()
|
||||
var e watch.Event
|
||||
var wres clientv3.WatchResponse
|
||||
watchCtx, _ := context.WithTimeout(ctx, wait.ForeverTestTimeout)
|
||||
select {
|
||||
case e = <-w.ResultChan():
|
||||
case <-watchCtx.Done():
|
||||
t.Fatalf("timed out waiting for watch event")
|
||||
}
|
||||
select {
|
||||
case wres = <-etcdW:
|
||||
case <-watchCtx.Done():
|
||||
t.Fatalf("timed out waiting for raw watch event")
|
||||
}
|
||||
watchedDeleteObj := e.Object.(*example.Pod)
|
||||
wres := <-etcdW
|
||||
|
||||
watchedDeleteRev, err := store.versioner.ParseResourceVersion(watchedDeleteObj.ResourceVersion)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue