Skip to content
Open
Changes from 1 commit
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
29 changes: 29 additions & 0 deletions driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"io"
"log"
"math"
mrand "math/rand"
"net"
"net/url"
"os"
Expand Down Expand Up @@ -3577,3 +3578,31 @@ func runCallCommand(dbt *DBTest, query, name string) {
}
}
}

func TestIssue1567(t *testing.T) {
// enable TLS.
runTests(t, dsn+"&tls=skip-verify", func(dbt *DBTest) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider enabling TLS 1.3 as the minimum version for enhanced security. This can be achieved by adding MinVersion: tls.VersionTLS13 to the TLS configuration. This ensures that the connection uses the most secure and up-to-date protocol version.

tls.Config{ InsecureSkipVerify: true, +MinVersion: tls.VersionTLS13 }

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
runTests(t, dsn+"&tls=skip-verify", func(dbt *DBTest) {
runTests(t, dsn+"&tls=skip-verify", func(dbt *DBTest) {

// disable connection pooling.
// data race happens when new connection is created.
dbt.db.SetMaxIdleConns(0)

// estimate round trip time.
start := time.Now()
if err := dbt.db.PingContext(context.Background()); err != nil {
t.Fatal(err)
}
rtt := time.Since(start)

count := 1000
if testing.Short() {
count = 10
}

for i := 0; i < count; i++ {
timeout := time.Duration(mrand.Int63n(int64(rtt)))
ctx, cancel := context.WithTimeout(context.Background(), timeout)
dbt.db.PingContext(ctx)
cancel()
}
})
}