/integrations/engine_group_test.go

https://github.com/xormplus/xorm · Go · 35 lines · 24 code · 8 blank · 3 comment · 2 complexity · c3de0bd24bf3385dbe2f2e68c37a40db MD5 · raw file

  1. // Copyright 2020 The Xorm Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package integrations
  5. import (
  6. "testing"
  7. "github.com/xormplus/xorm"
  8. "github.com/xormplus/xorm/log"
  9. "github.com/xormplus/xorm/schemas"
  10. "github.com/stretchr/testify/assert"
  11. )
  12. func TestEngineGroup(t *testing.T) {
  13. assert.NoError(t, PrepareEngine())
  14. main := testEngine.(*xorm.Engine)
  15. if main.Dialect().URI().DBType == schemas.SQLITE {
  16. t.Skip()
  17. return
  18. }
  19. eg, err := xorm.NewEngineGroup(main, []*xorm.Engine{main})
  20. assert.NoError(t, err)
  21. eg.SetMaxIdleConns(10)
  22. eg.SetMaxOpenConns(100)
  23. eg.SetTableMapper(main.GetTableMapper())
  24. eg.SetColumnMapper(main.GetColumnMapper())
  25. eg.SetLogLevel(log.LOG_INFO)
  26. eg.ShowSQL(true)
  27. }