package users import ( "fmt" "os" "testing" "gitlab.quimbo.fr/odwrtw/canape-sql/sqltest" "github.com/jmoiron/sqlx" _ "github.com/lib/pq" ) const drop = `DROP TABLE users;` var db *sqlx.DB func init() { var err error pgdsn := os.Getenv("POSTGRES_DSN") db, err = sqlx.Connect("postgres", pgdsn) if err != nil { fmt.Printf("Unavailable PG tests:\n %v\n", err) os.Exit(1) } } func TestAdd(t *testing.T) { sqltest.RunWithSchema(db, usersCreate, drop, t, func(db *sqlx.DB, t *testing.T) { }) }