Created testdatabase Package to Open DB Conn

This commit is contained in:
Brad Rydzewski 2014-06-12 15:23:56 -07:00
parent 47ea0cbd29
commit e2c7878efb
4 changed files with 8 additions and 9 deletions

View file

@ -7,7 +7,7 @@ import (
"github.com/drone/drone/server/database/schema"
"github.com/drone/drone/server/database/testdata"
_ "github.com/mattn/go-sqlite3"
"github.com/drone/drone/server/database/testdatabase"
)
// in-memory database instance for unit testing
@ -15,7 +15,7 @@ var db *sql.DB
// setup the test database and test fixtures
func setup() {
db, _ = sql.Open("sqlite3", ":memory:")
db, _ = testdatabase.Open()
schema.Load(db)
testdata.Load(db)
}

View file

@ -2,14 +2,13 @@ package perm
import (
"database/sql"
//"strings"
"testing"
"github.com/drone/drone/server/database/schema"
"github.com/drone/drone/server/database/testdata"
"github.com/drone/drone/server/database/testdatabase"
"github.com/drone/drone/server/resource/repo"
"github.com/drone/drone/server/resource/user"
_ "github.com/mattn/go-sqlite3"
)
// in-memory database instance for unit testing
@ -17,7 +16,7 @@ var db *sql.DB
// setup the test database and test fixtures
func setup() {
db, _ = sql.Open("sqlite3", ":memory:")
db, _ = testdatabase.Open()
schema.Load(db)
testdata.Load(db)
}

View file

@ -6,7 +6,7 @@ import (
"github.com/drone/drone/server/database/schema"
"github.com/drone/drone/server/database/testdata"
_ "github.com/mattn/go-sqlite3"
"github.com/drone/drone/server/database/testdatabase"
)
// in-memory database instance for unit testing
@ -14,7 +14,7 @@ var db *sql.DB
// setup the test database and test fixtures
func setup() {
db, _ = sql.Open("sqlite3", ":memory:")
db, _ = testdatabase.Open()
schema.Load(db)
testdata.Load(db)
}

View file

@ -6,7 +6,7 @@ import (
"github.com/drone/drone/server/database/schema"
"github.com/drone/drone/server/database/testdata"
_ "github.com/mattn/go-sqlite3"
"github.com/drone/drone/server/database/testdatabase"
)
// in-memory database instance for unit testing
@ -14,7 +14,7 @@ var db *sql.DB
// setup the test database and test fixtures
func setup() {
db, _ = sql.Open("sqlite3", ":memory:")
db, _ = testdatabase.Open()
schema.Load(db)
testdata.Load(db)
}