(t *testing.T)
| 93 | } |
| 94 | |
| 95 | func TestRedisCacheError(t *testing.T) { |
| 96 | c := newRedisCache() |
| 97 | defer c.Close() |
| 98 | testData := c.TestDataSlice[0].(*redisUser) |
| 99 | iCache := c.ICache.(Cache) |
| 100 | |
| 101 | // Set empty key error test |
| 102 | key := utils.Uint64ToStr(testData.ID) |
| 103 | err := iCache.Set(c.Ctx, "", c.TestDataMap[key], time.Minute) |
| 104 | assert.Error(t, err) |
| 105 | |
| 106 | // Set empty value error test |
| 107 | key = utils.Uint64ToStr(testData.ID) |
| 108 | err = iCache.Set(c.Ctx, key, nil, time.Minute) |
| 109 | assert.Error(t, err) |
| 110 | |
| 111 | // Get empty key error test |
| 112 | val := &redisUser{} |
| 113 | err = iCache.Get(c.Ctx, "", val) |
| 114 | assert.Error(t, err) |
| 115 | |
| 116 | // Get empty result test |
| 117 | key = utils.Uint64ToStr(testData.ID) |
| 118 | err = iCache.Get(c.Ctx, key, val) |
| 119 | assert.Error(t, err) |
| 120 | |
| 121 | // Get result error test |
| 122 | key = utils.Uint64ToStr(testData.ID) |
| 123 | _ = iCache.Set(c.Ctx, key, c.TestDataMap[key], time.Minute) |
| 124 | time.Sleep(time.Millisecond) |
| 125 | err = iCache.Get(c.Ctx, key, nil) |
| 126 | assert.Error(t, err) |
| 127 | |
| 128 | _ = iCache.MultiSet(c.Ctx, nil, time.Minute) |
| 129 | _ = iCache.MultiGet(c.Ctx, nil, time.Minute) |
| 130 | |
| 131 | // Del empty key error test |
| 132 | err = iCache.Del(c.Ctx) |
| 133 | assert.NoError(t, err) |
| 134 | err = iCache.Del(c.Ctx, "") |
| 135 | assert.NoError(t, err) |
| 136 | } |
| 137 | |
| 138 | func TestRedisClusterCache(t *testing.T) { |
| 139 | c := newRedisClusterCache() |
nothing calls this directly
no test coverage detected