Created testdatabase Package to Open DB Conn
This commit is contained in:
parent
47ea0cbd29
commit
e2c7878efb
4 changed files with 8 additions and 9 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue