diff --git a/templates_test/main_test/postgres_main.tpl b/templates_test/main_test/postgres_main.tpl
index d195143..0abcba3 100644
--- a/templates_test/main_test/postgres_main.tpl
+++ b/templates_test/main_test/postgres_main.tpl
@@ -101,7 +101,7 @@ func (p *pgTester) pgEnv() []string {
     fmt.Sprintf("PGHOST=%s", p.host),
     fmt.Sprintf("PGPORT=%d", p.port),
     fmt.Sprintf("PGUSER=%s", p.user),
-    fmt.Sprintf("PGPASS=%s", p.pgPassFile),
+    fmt.Sprintf("PGPASSFILE=%s", p.pgPassFile),
   }
 }
 
@@ -111,6 +111,12 @@ func (p *pgTester) makePGPassFile() error {
     return errors.Wrap(err, "failed to create option file")
   }
 
+  fmt.Fprintf(tmp, "%s:%d:postgres:%s", p.host, p.port, p.user)
+  if len(p.pass) != 0 {
+    fmt.Fprintf(tmp, ":%s", p.pass)
+  }
+  fmt.Fprintln(tmp)
+
   fmt.Fprintf(tmp, "%s:%d:%s:%s", p.host, p.port, p.dbName, p.user)
   if len(p.pass) != 0 {
     fmt.Fprintf(tmp, ":%s", p.pass)