MCPcopy Create free account
hub / github.com/go-dev-frame/sponge / TestInitMysqlError

Function TestInitMysqlError

internal/database/init_test.go:37–52  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35}
36
37func TestInitMysqlError(t *testing.T) {
38 err := config.Init(configs.Path("serverNameExample.yml"))
39 if err != nil {
40 panic(err)
41 }
42
43 // change config error test
44 config.Get().Database.Mysql.Dsn = "root:123456@(127.0.0.1:3306)/test"
45
46 utils.SafeRunWithTimeout(time.Second*2, func(cancel context.CancelFunc) {
47 _ = CloseDB()
48 InitMysql()
49 assert.NotNil(t, gdb)
50 cancel()
51 })
52}
53
54func TestInitPostgresqlError(t *testing.T) {
55 _ = config.Init(configs.Path("serverNameExample.yml"))

Callers

nothing calls this directly

Calls 6

InitFunction · 0.92
PathFunction · 0.92
GetFunction · 0.92
SafeRunWithTimeoutFunction · 0.92
InitMysqlFunction · 0.85
CloseDBFunction · 0.70

Tested by

no test coverage detected