xorm/engine_group_test.go

34 lines
734 B
Go
Raw Normal View History

2020-03-12 15:36:04 +00:00
// Copyright 2020 The Xorm Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package xorm
import (
"testing"
"github.com/stretchr/testify/assert"
"xorm.io/xorm/log"
2020-03-12 15:54:27 +00:00
"xorm.io/xorm/schemas"
2020-03-12 15:36:04 +00:00
)
func TestEngineGroup(t *testing.T) {
assert.NoError(t, prepareEngine())
master := testEngine.(*Engine)
2020-03-12 15:54:27 +00:00
if master.Dialect().URI().DBType == schemas.SQLITE {
t.Skip()
return
}
2020-03-12 15:36:04 +00:00
eg, err := NewEngineGroup(master, []*Engine{master})
assert.NoError(t, err)
eg.SetMaxIdleConns(10)
eg.SetMaxOpenConns(100)
eg.SetTableMapper(master.GetTableMapper())
eg.SetColumnMapper(master.GetColumnMapper())
eg.SetLogLevel(log.LOG_INFO)
eg.ShowSQL(true)
}