Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix flaky test. #1663

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3608,6 +3608,12 @@ func runCallCommand(dbt *DBTest, query, name string) {
func TestIssue1567(t *testing.T) {
// enable TLS.
runTests(t, dsn+"&tls=skip-verify", func(dbt *DBTest) {
var max int
err := dbt.db.QueryRow("SELECT @@max_connections").Scan(&max)
if err != nil {
dbt.Fatalf("%s", err.Error())
}

// disable connection pooling.
// data race happens when new connection is created.
dbt.db.SetMaxIdleConns(0)
Expand All @@ -3627,6 +3633,9 @@ func TestIssue1567(t *testing.T) {
if testing.Short() {
count = 10
}
if count > max {
count = max
}

for i := 0; i < count; i++ {
timeout := time.Duration(mrand.Int63n(int64(rtt)))
Expand Down
Loading