mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
database testing: do not use regular DB name for DB testing but only dummy DB
This commit is contained in:
parent
6221f7d851
commit
69c299215c
1 changed files with 8 additions and 9 deletions
|
@ -18,19 +18,18 @@ func fM(s string, id uint) string {
|
|||
|
||||
func TestMain(m *testing.M) {
|
||||
db = DummyInitDB()
|
||||
defer db.Close()
|
||||
|
||||
// Verify that you can connect to the database
|
||||
err := db.DB().Ping()
|
||||
if err != nil {
|
||||
fmt.Println("Error: DB must ping to run tests")
|
||||
return
|
||||
}
|
||||
|
||||
defer db.Close()
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
// Verify that you can connect to the database
|
||||
func TestDBConnection(t *testing.T) {
|
||||
db := InitDB()
|
||||
defer db.Close()
|
||||
|
||||
assert.NoError(t, VerifyConnection(db), "DB must ping")
|
||||
}
|
||||
|
||||
func TestUserAssociations(t *testing.T) {
|
||||
|
||||
DropTables(db)
|
||||
|
|
Loading…
Add table
Reference in a new issue