mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(loggin): disable logging by default so unit tests are not full of logging
This commit is contained in:
@@ -12,8 +12,6 @@ import (
|
||||
)
|
||||
|
||||
func InitTestDB(t *testing.T) {
|
||||
|
||||
t.Log("InitTestDB")
|
||||
x, err := xorm.NewEngine(sqlutil.TestDB_Sqlite3.DriverName, sqlutil.TestDB_Sqlite3.ConnStr)
|
||||
//x, err := xorm.NewEngine(sqlutil.TestDB_Mysql.DriverName, sqlutil.TestDB_Mysql.ConnStr)
|
||||
//x, err := xorm.NewEngine(sqlutil.TestDB_Postgres.DriverName, sqlutil.TestDB_Postgres.ConnStr)
|
||||
@@ -24,7 +22,7 @@ func InitTestDB(t *testing.T) {
|
||||
|
||||
sqlutil.CleanDB(x)
|
||||
|
||||
if err := SetEngine(x, false); err != nil {
|
||||
if err := SetEngine(x); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"github.com/go-xorm/xorm"
|
||||
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/sqlutil"
|
||||
"github.com/inconshreveable/log15"
|
||||
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
@@ -29,7 +28,6 @@ func TestMigrations(t *testing.T) {
|
||||
sqlutil.CleanDB(x)
|
||||
|
||||
mg := NewMigrator(x)
|
||||
mg.Logger.SetHandler(log15.DiscardHandler())
|
||||
AddMigrations(mg)
|
||||
|
||||
err = mg.Start()
|
||||
|
||||
@@ -107,7 +107,7 @@ func (mg *Migrator) Start() error {
|
||||
}
|
||||
|
||||
func (mg *Migrator) exec(m Migration) error {
|
||||
log.Info("Executing migration", "id", m.Id())
|
||||
mg.Logger.Info("Executing migration", "id", m.Id())
|
||||
|
||||
err := mg.inTransaction(func(sess *xorm.Session) error {
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ func NewEngine() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
err = SetEngine(x, setting.Env == setting.DEV)
|
||||
err = SetEngine(x)
|
||||
|
||||
if err != nil {
|
||||
sqlog.Error("Fail to initialize orm engine", "error", err)
|
||||
@@ -86,7 +86,7 @@ func NewEngine() {
|
||||
}
|
||||
}
|
||||
|
||||
func SetEngine(engine *xorm.Engine, enableLog bool) (err error) {
|
||||
func SetEngine(engine *xorm.Engine) (err error) {
|
||||
x = engine
|
||||
dialect = migrator.NewDialect(x.DriverName())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user