TestConnectWithFallback: increase timeout

on Windows connecting on a closed port takes about 2 seconds.
You can test with something like this

        start := time.Now()
	_, err := d.DialContext(context.Background(), "tcp", "127.0.0.1:1")
	fmt.Printf("finished, time %s, err: %v\n", time.Since(start), err)

This seems by design

https://groups.google.com/g/comp.os.ms-windows.programmer.win32/c/jV6kRVY3BqM

Generally TestConnectWithFallback takes about 8-9 seconds on Windows.
Increase timeout to avoid random failures under load
pull/1648/head
Nicola Murino 2023-06-15 15:24:03 +02:00 committed by Jack Christensen
parent 461b9fa36e
commit b1f8055584
1 changed files with 1 additions and 1 deletions

View File

@ -496,7 +496,7 @@ func TestConnectWithRuntimeParams(t *testing.T) {
func TestConnectWithFallback(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
config, err := pgconn.ParseConfig(os.Getenv("PGX_TEST_DATABASE"))