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

Function TestInitRedis

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

Source from the content-addressed store, hash-verified

82}
83
84func TestInitRedis(t *testing.T) {
85 defer func() {
86 if e := recover(); e != nil {
87 t.Log("ignore connect redis error info")
88 }
89 }()
90
91 err := config.Init(configs.Path("serverNameExample.yml"))
92 if err != nil {
93 panic(err)
94 }
95
96 InitRedis()
97 cli := GetRedisCli()
98 assert.NotNil(t, cli)
99 time.Sleep(time.Millisecond * 10)
100 err = CloseRedis()
101 assert.NoError(t, err)
102
103 // change config error test
104 config.Get().App.EnableTrace = true
105 config.Get().Redis.Dsn = "default:123456@127.0.0.1:6379/0"
106 redisCli = nil
107 _ = CloseRedis()
108 _ = GetRedisCli()
109}
110
111func TestGetCacheType(t *testing.T) {
112 InitCache("memory")

Callers

nothing calls this directly

Calls 6

InitFunction · 0.92
PathFunction · 0.92
GetFunction · 0.92
InitRedisFunction · 0.85
GetRedisCliFunction · 0.85
CloseRedisFunction · 0.85

Tested by

no test coverage detected