From e2c7878efb2cd3baa6641c2fa18d2f4513705fea Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Thu, 12 Jun 2014 15:23:56 -0700 Subject: [PATCH] Created testdatabase Package to Open DB Conn --- server/resource/commit/manager_test.go | 4 ++-- server/resource/perm/manager_test.go | 5 ++--- server/resource/repo/manager_test.go | 4 ++-- server/resource/user/manager_test.go | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/server/resource/commit/manager_test.go b/server/resource/commit/manager_test.go index 2da29b8d..4bda1335 100644 --- a/server/resource/commit/manager_test.go +++ b/server/resource/commit/manager_test.go @@ -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) } diff --git a/server/resource/perm/manager_test.go b/server/resource/perm/manager_test.go index 5f872be7..c7f138db 100644 --- a/server/resource/perm/manager_test.go +++ b/server/resource/perm/manager_test.go @@ -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) } diff --git a/server/resource/repo/manager_test.go b/server/resource/repo/manager_test.go index 0456bf7f..46d3f73e 100644 --- a/server/resource/repo/manager_test.go +++ b/server/resource/repo/manager_test.go @@ -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) } diff --git a/server/resource/user/manager_test.go b/server/resource/user/manager_test.go index 7471756b..17fb9a6c 100644 --- a/server/resource/user/manager_test.go +++ b/server/resource/user/manager_test.go @@ -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) }