gf/g/database/gdb/gdb_unit_basic_test.go

29 lines
660 B
Go
Raw Normal View History

// Copyright 2019 gf Author(https://github.com/gogf/gf). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package gdb_test
import (
2019-06-19 09:06:52 +08:00
"github.com/gogf/gf/g/database/gdb"
"github.com/gogf/gf/g/test/gtest"
"testing"
)
func Test_Instance(t *testing.T) {
2019-06-19 09:06:52 +08:00
gtest.Case(t, func() {
_, err := gdb.Instance("none")
gtest.AssertNE(err, nil)
2019-06-19 09:06:52 +08:00
db, err := gdb.Instance()
gtest.Assert(err, nil)
2019-06-19 09:06:52 +08:00
err1 := db.PingMaster()
err2 := db.PingSlave()
gtest.Assert(err1, nil)
gtest.Assert(err2, nil)
})
}