Skip to content

Commit 7505c41

Browse files
committed
fix: improve etcd registry test case
1 parent c1fe14b commit 7505c41

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/registry/etcdv3/registry_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,10 @@ func TestKeepalive(t *testing.T) {
180180
lease := reg.getLeaseID()
181181
reg.client.Revoke(reg.ctx, lease)
182182

183-
time.Sleep(1 * time.Second)
184-
assert.NotZero(t, reg.getLeaseID())
183+
assert.Eventually(t, func() bool {
184+
return reg.getLeaseID() != 0
185+
}, 5*time.Second, time.Second)
186+
185187
assert.True(t, lease != reg.getLeaseID())
186188

187189
ttl, err := reg.client.TimeToLive(reg.ctx, lease)

0 commit comments

Comments
 (0)