mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-26 15:08:28 +00:00
Really SKIP_NODB (#2472)
* Really SKIP_NODB * Use fatalError in createLocalDB * Check if createdb exists * Revert change * Remove !Quiet
This commit is contained in:
parent
b3162755a9
commit
f321a7d55e
1 changed files with 6 additions and 2 deletions
|
@ -44,8 +44,9 @@ func fatalError(t *testing.T, format string, args ...interface{}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func createLocalDB(t *testing.T, dbName string) {
|
func createLocalDB(t *testing.T, dbName string) {
|
||||||
if !Quiet {
|
if _, err := exec.LookPath("createdb"); err != nil {
|
||||||
t.Log("Note: tests require a postgres install accessible to the current user")
|
fatalError(t, "Note: tests require a postgres install accessible to the current user")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
createDB := exec.Command("createdb", dbName)
|
createDB := exec.Command("createdb", dbName)
|
||||||
if !Quiet {
|
if !Quiet {
|
||||||
|
@ -63,6 +64,9 @@ func createRemoteDB(t *testing.T, dbName, user, connStr string) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fatalError(t, "failed to open postgres conn with connstr=%s : %s", connStr, err)
|
fatalError(t, "failed to open postgres conn with connstr=%s : %s", connStr, err)
|
||||||
}
|
}
|
||||||
|
if err = db.Ping(); err != nil {
|
||||||
|
fatalError(t, "failed to open postgres conn with connstr=%s : %s", connStr, err)
|
||||||
|
}
|
||||||
_, err = db.Exec(fmt.Sprintf(`CREATE DATABASE %s;`, dbName))
|
_, err = db.Exec(fmt.Sprintf(`CREATE DATABASE %s;`, dbName))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pqErr, ok := err.(*pq.Error)
|
pqErr, ok := err.(*pq.Error)
|
||||||
|
|
Loading…
Reference in a new issue