We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentd7bdb3c commit495222cCopy full SHA for 495222c
coderd/database/dbtestutil/postgres.go
@@ -40,6 +40,10 @@ func (p ConnectionParams) DSN() string {
40
returnfmt.Sprintf("postgres://%s:%s@%s:%s/%s?sslmode=disable",p.Username,p.Password,p.Host,p.Port,p.DBName)
41
}
42
43
+funcWillLogDSN()bool {
44
+returnos.Getenv("CODER_TEST_LOG_PG_DSN")!=""
45
+}
46
+
47
// These variables are global because all tests share them.
48
var (
49
connectionParamsInitOnce sync.Once
@@ -227,6 +231,12 @@ func Open(t TBSubset, opts ...OpenOption) (string, error) {
227
231
Port:port,
228
232
DBName:dbName,
229
233
}.DSN()
234
235
+// Optionally log the DSN to help connect to the test database.
236
+ifWillLogDSN() {
237
+t.Logf("Postgres test DSN: %s",dsn)
238
+_,_=fmt.Fprintln(os.Stderr,"Postgres test DSN:",dsn)
239
230
240
returndsn,nil
241
242