(t *testing.T)
| 82 | } |
| 83 | |
| 84 | func 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 | |
| 111 | func TestGetCacheType(t *testing.T) { |
| 112 | InitCache("memory") |
nothing calls this directly
no test coverage detected