mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
integration_test: fix the flaky test TestV3AuthRestartMembe
Signed-off-by: Benjamin Wang <wachao@vmware.com>
This commit is contained in:
parent
bbcbcd9db4
commit
e8ad008067
@ -1097,11 +1097,15 @@ func (m *Member) WaitStarted(t testutil.TB) {
|
||||
}
|
||||
|
||||
func WaitClientV3(t testutil.TB, kv clientv3.KV) {
|
||||
WaitClientV3WithKey(t, kv, "/")
|
||||
}
|
||||
|
||||
func WaitClientV3WithKey(t testutil.TB, kv clientv3.KV, key string) {
|
||||
timeout := time.Now().Add(RequestTimeout)
|
||||
var err error
|
||||
for time.Now().Before(timeout) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), RequestTimeout)
|
||||
_, err = kv.Get(ctx, "/")
|
||||
_, err = kv.Get(ctx, key)
|
||||
cancel()
|
||||
if err == nil {
|
||||
return
|
||||
|
@ -492,6 +492,7 @@ func TestV3AuthRestartMember(t *testing.T) {
|
||||
clus.Members[0].Stop(t)
|
||||
err = clus.Members[0].Restart(t)
|
||||
testutil.AssertNil(t, err)
|
||||
integration.WaitClientV3WithKey(t, c2.KV, "foo")
|
||||
|
||||
// nothing has changed, but it fails without refreshing cache after restart
|
||||
_, err = c2.Put(context.TODO(), "foo", "bar2")
|
||||
|
Loading…
x
Reference in New Issue
Block a user