jet/tests/postgres/main_test.go

28 lines
420 B
Go
Raw Normal View History

2019-07-30 11:45:10 +02:00
package postgres
2019-04-07 09:58:12 +02:00
import (
"database/sql"
2019-06-11 12:47:35 +02:00
"github.com/go-jet/jet/tests/dbconfig"
2019-04-14 17:55:10 +02:00
_ "github.com/lib/pq"
2019-05-20 17:37:55 +02:00
"github.com/pkg/profile"
2019-04-07 09:58:12 +02:00
"os"
"testing"
)
var db *sql.DB
2019-04-14 17:55:10 +02:00
2019-04-07 09:58:12 +02:00
func TestMain(m *testing.M) {
2019-05-20 17:37:55 +02:00
defer profile.Start().Stop()
2019-04-07 09:58:12 +02:00
var err error
2019-07-29 18:08:53 +02:00
db, err = sql.Open("postgres", dbconfig.PostgresConnectString)
2019-04-07 09:58:12 +02:00
if err != nil {
panic("Failed to connect to test db")
}
2019-06-11 12:47:35 +02:00
defer db.Close()
2019-04-07 09:58:12 +02:00
ret := m.Run()
os.Exit(ret)
}