mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
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>
This commit is contained in:
parent
75b19b242c
commit
fc33d0176a
@ -300,9 +300,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
Block a user