Skip to content

Commit

Permalink
wait for the member to get started
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Wang <[email protected]>
  • Loading branch information
ahrtr committed Jan 18, 2025
1 parent 2f37f48 commit bc4669c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/common/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ func TestAuthGracefulDisable(t *testing.T) {
donec := make(chan struct{})
rootAuthClient := testutils.MustClient(clus.Client(WithAuth(rootUserName, rootPassword)))

startedC := make(chan struct{}, 1)
go func() {
defer close(donec)
defer close(startedC)
// sleep a bit to let the watcher connects while auth is still enabled
time.Sleep(time.Second)
// now disable auth...
Expand All @@ -112,10 +114,13 @@ func TestAuthGracefulDisable(t *testing.T) {
t.Errorf("failed to restart member %v", err)
return
}
startedC <- struct{}{}
// the watcher should still work after reconnecting
assert.NoErrorf(t, rootAuthClient.Put(ctx, "key", "value", config.PutOptions{}), "failed to put key value")
}()

<-startedC

wCtx, wCancel := context.WithCancel(ctx)
defer wCancel()

Expand Down

0 comments on commit bc4669c

Please sign in to comment.