(t *testing.T)
| 120 | |
| 121 | } |
| 122 | func TestDecodingCorruptedMetadata(t *testing.T) { |
| 123 | c := getRedisCache(t) |
| 124 | |
| 125 | // this test will make fetching the length of a payload fail |
| 126 | _, _, err := c.decodeMetadata([]byte{}) |
| 127 | if (err == nil || !errors.Is(err, &RedisCacheCorruptionError{})) { |
| 128 | t.Fatalf("expected a corruption error, err=%s", err) |
| 129 | } |
| 130 | |
| 131 | // this test will make fetching a string in the metadata fail because it can't read the length of a metadata string |
| 132 | _, _, err = c.decodeMetadata([]byte{0, 0, 0, 0, 1, 1, 1, 1}) |
| 133 | if (err == nil || !errors.Is(err, &RedisCacheCorruptionError{})) { |
| 134 | t.Fatalf("expected a corruption error, err=%s", err) |
| 135 | } |
| 136 | // this test will make fetching a string in the metadata fail because the length of a metadata string doesn't match it's size |
| 137 | _, _, err = c.decodeMetadata([]byte{0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}) |
| 138 | if (err == nil || !errors.Is(err, &RedisCacheCorruptionError{})) { |
| 139 | t.Fatalf("expected a corruption error, err=%s", err) |
| 140 | } |
| 141 | |
| 142 | } |
| 143 | |
| 144 | func TestKeyExpirationWhileFetchtingRedis(t *testing.T) { |
| 145 | cache, redis := getRedisCacheAndServer(t) |
nothing calls this directly
no test coverage detected