Files
zeekay cff8c69948 sdk: test kits, drivers, and the tests that run on them
Adds sdk/sqltest, sdk/sqlcheck and sdk/driver/{postgres,kv,s3} with the
tests they unlock. postgres.Declare names the subsystems that live on
hanzo-sql; the host declares them at start.

Claude-Session: https://claude.ai/code/session_015XYKLn69gF4x75RWePpDBV
2026-11-20 21:01:20 -08:00

30 lines
741 B
Go

package postgres
import (
"testing"
"time"
)
// The bound on reaching a server is dialTimeout unless CLOUD_SQL_DIAL_TIMEOUT names a
// positive duration, and a value that is not one never shortens it to nothing.
func TestDialBoundReadsAPositiveDurationAndOtherwiseKeepsTheDefault(t *testing.T) {
for _, c := range []struct {
env string
want time.Duration
}{
{"", dialTimeout},
{"30s", 30 * time.Second},
{" 45s ", 45 * time.Second},
{"1m30s", 90 * time.Second},
{"30", dialTimeout},
{"soon", dialTimeout},
{"0s", dialTimeout},
{"-5s", dialTimeout},
} {
t.Setenv(DialTimeoutEnv, c.env)
if got := dialBound(); got != c.want {
t.Errorf("%s=%q: bound %v, want %v", DialTimeoutEnv, c.env, got, c.want)
}
}
}