Skip to content

Commit

Permalink
Merge pull request #905 from asubiotto/oenv
Browse files Browse the repository at this point in the history
Make TestCloseBadConn observe PGHOST and PGPORT
  • Loading branch information
maddyblue committed Oct 11, 2019
2 parents 931b5ae + 16412e5 commit f91d341
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,15 @@ func TestBadConn(t *testing.T) {
// TestCloseBadConn tests that the underlying connection can be closed with
// Close after an error.
func TestCloseBadConn(t *testing.T) {
nc, err := net.Dial("tcp", "localhost:5432")
host := os.Getenv("PGHOST")
if host == "" {
host = "localhost"
}
port := os.Getenv("PGPORT")
if port == "" {
port = "5432"
}
nc, err := net.Dial("tcp", host+":"+port)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit f91d341

Please sign in to comment.