mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-07-23 12:51:40 +02:00
Adapt testing
This commit is contained in:
25
test/db.go
Normal file
25
test/db.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
||||
func InitDB() *sqlx.DB {
|
||||
|
||||
bp := "./"
|
||||
ebp := os.Getenv("BASEPATH")
|
||||
|
||||
if ebp != "" {
|
||||
bp = ebp + "test/"
|
||||
}
|
||||
|
||||
db, err := sqlx.Open("sqlite3", bp+"test.db")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
return db
|
||||
}
|
BIN
test/test.db
Normal file
BIN
test/test.db
Normal file
Binary file not shown.
Reference in New Issue
Block a user