Skip to content

Commit 1dcdfc1

Browse files
committed
Update TestAuthGracefulDisable to wait for member to get started
Signed-off-by: Benjamin Wang <[email protected]>
1 parent b1e5ebc commit 1dcdfc1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/common/auth_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ func TestAuthGracefulDisable(t *testing.T) {
9797
donec := make(chan struct{})
9898
rootAuthClient := testutils.MustClient(clus.Client(WithAuth(rootUserName, rootPassword)))
9999

100+
startedC := make(chan struct{}, 1)
100101
go func() {
101102
defer close(donec)
103+
defer close(startedC)
102104
// sleep a bit to let the watcher connects while auth is still enabled
103105
time.Sleep(time.Second)
104106
// now disable auth...
@@ -112,10 +114,12 @@ func TestAuthGracefulDisable(t *testing.T) {
112114
t.Errorf("failed to restart member %v", err)
113115
return
114116
}
117+
startedC <- struct{}{}
115118
// the watcher should still work after reconnecting
116119
assert.NoErrorf(t, rootAuthClient.Put(ctx, "key", "value", config.PutOptions{}), "failed to put key value")
117120
}()
118121

122+
<-startedC
119123
wCtx, wCancel := context.WithCancel(ctx)
120124
defer wCancel()
121125

0 commit comments

Comments
 (0)