Skip to content

Commit

Permalink
[release-21.0] Flakes: Address flakiness in TestZkConnClosedOnDisconn…
Browse files Browse the repository at this point in the history
…ect (#17194) (#17197)

Signed-off-by: Matt Lord <mattalord@gmail.com>
Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
  • Loading branch information
vitess-bot[bot] authored Nov 9, 2024
1 parent a718a56 commit a2d8f71
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions go/vt/topo/zk2topo/zk_conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package zk2topo
import (
"context"
"testing"
"time"

"github.com/stretchr/testify/require"
"github.com/z-division/go-zookeeper/zk"
Expand All @@ -42,12 +43,16 @@ func TestZkConnClosedOnDisconnect(t *testing.T) {
oldConn := conn.conn

// force a disconnect
zkd.Shutdown()
zkd.Start()
err = zkd.Shutdown()
require.NoError(t, err)
err = zkd.Start()
require.NoError(t, err)

// do another get to trigger a new connection
_, _, err = conn.Get(context.Background(), "/")
require.NoError(t, err, "Get() failed")
require.Eventually(t, func() bool {
_, _, err = conn.Get(context.Background(), "/")
return err == nil
}, 10*time.Second, 100*time.Millisecond)

// Check that old connection is closed
_, _, err = oldConn.Get("/")
Expand Down

0 comments on commit a2d8f71

Please sign in to comment.