package store import ( "testing" "time" "github.com/jackc/pgx/v5" ) func TestAStoreMachineThatIsGoneIsGivenUpOnInSeconds(t *testing.T) { cfg, err := pgx.ParseConfig("postgres://u:p@10.0.0.158:5432,10.0.0.159:5432/llmgw?sslmode=disable&target_session_attrs=read-write") if err != nil { t.Fatal(err) } failFast(cfg) if cfg.ConnectTimeout != storeConnectTimeout || cfg.DialFunc == nil { t.Errorf("timeout %s, dialer set %v", cfg.ConnectTimeout, cfg.DialFunc != nil) } // One the address asks for is its own. cfg, _ = pgx.ParseConfig("postgres://u:p@h:5432/llmgw?sslmode=disable&connect_timeout=12") failFast(cfg) if cfg.ConnectTimeout != 12*time.Second { t.Errorf("the address's own timeout was replaced: %s", cfg.ConnectTimeout) } }