Skip to content

Commit 7944155

Browse files
committed
fix flaky test.
1 parent 255d1ad commit 7944155

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

driver_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -3608,6 +3608,12 @@ func runCallCommand(dbt *DBTest, query, name string) {
36083608
func TestIssue1567(t *testing.T) {
36093609
// enable TLS.
36103610
runTests(t, dsn+"&tls=skip-verify", func(dbt *DBTest) {
3611+
var max int
3612+
err := dbt.db.QueryRow("SELECT @@max_connections").Scan(&max)
3613+
if err != nil {
3614+
dbt.Fatalf("%s", err.Error())
3615+
}
3616+
36113617
// disable connection pooling.
36123618
// data race happens when new connection is created.
36133619
dbt.db.SetMaxIdleConns(0)
@@ -3627,6 +3633,9 @@ func TestIssue1567(t *testing.T) {
36273633
if testing.Short() {
36283634
count = 10
36293635
}
3636+
if count > max {
3637+
count = max
3638+
}
36303639

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

0 commit comments

Comments
 (0)