mirror of
https://gitee.com/johng/gf.git
synced 2024-12-05 05:37:55 +08:00
29 lines
723 B
Go
29 lines
723 B
Go
// 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 (
|
|
"github.com/gogf/gf/g/database/gdb"
|
|
"github.com/gogf/gf/g/test/gtest"
|
|
"testing"
|
|
)
|
|
|
|
func Test_Instance(t *testing.T) {
|
|
gtest.Case(t, func() {
|
|
_, err := gdb.Instance("none")
|
|
gtest.AssertNE(err, nil)
|
|
|
|
db, err := gdb.Instance()
|
|
gtest.Assert(err, nil)
|
|
|
|
err1 := db.PingMaster()
|
|
err2 := db.PingSlave()
|
|
gtest.Assert(err1, nil)
|
|
gtest.Assert(err2, nil)
|
|
})
|
|
}
|