Skip to content

Commit

Permalink
test: fix connection_pool test
Browse files Browse the repository at this point in the history
Changed checkTimeout time in test.

Part of #157
  • Loading branch information
better0fdead committed Feb 7, 2023
1 parent 7decb9d commit e2142e9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions connection_pool/connection_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2164,7 +2164,11 @@ func TestConnectionPool_NewWatcher_update(t *testing.T) {
err := test_helpers.SetClusterRO(servers, opts, roles)
require.Nilf(t, err, "fail to set roles for cluster")

pool, err := connection_pool.Connect(servers, opts)
poolOpts := connection_pool.OptsPool{
CheckTimeout: 500 * time.Millisecond,
}
pool, err := connection_pool.ConnectWithOpts(servers, opts, poolOpts)

require.Nilf(t, err, "failed to connect")
require.NotNilf(t, pool, "conn is nil after Connect")
defer pool.Close()
Expand Down Expand Up @@ -2192,7 +2196,7 @@ func TestConnectionPool_NewWatcher_update(t *testing.T) {
} else {
testMap[addr] = 1
}
case <-time.After(time.Second):
case <-time.After(poolOpts.CheckTimeout * 2):
t.Errorf("Failed to get a watch init event.")
break
}
Expand Down

0 comments on commit e2142e9

Please sign in to comment.