Skip to content

Commit f91d341

Browse files
authored
Merge pull request #905 from asubiotto/oenv
Make TestCloseBadConn observe PGHOST and PGPORT
2 parents 931b5ae + 16412e5 commit f91d341

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

conn_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,15 @@ func TestBadConn(t *testing.T) {
724724
// TestCloseBadConn tests that the underlying connection can be closed with
725725
// Close after an error.
726726
func TestCloseBadConn(t *testing.T) {
727-
nc, err := net.Dial("tcp", "localhost:5432")
727+
host := os.Getenv("PGHOST")
728+
if host == "" {
729+
host = "localhost"
730+
}
731+
port := os.Getenv("PGPORT")
732+
if port == "" {
733+
port = "5432"
734+
}
735+
nc, err := net.Dial("tcp", host+":"+port)
728736
if err != nil {
729737
t.Fatal(err)
730738
}

0 commit comments

Comments
 (0)