(t *testing.T)
| 277 | } |
| 278 | |
| 279 | func TestPersistentLRUCacheNil(t *testing.T) { |
| 280 | ctx := testlogging.ContextWithLevel(t, testlogging.LevelInfo) |
| 281 | |
| 282 | var pc *cache.PersistentCache |
| 283 | |
| 284 | // no-op |
| 285 | pc.Close(ctx) |
| 286 | pc.Put(ctx, "key", gather.FromSlice([]byte{1, 2, 3})) |
| 287 | verifyNotCached(ctx, t, pc, "key") |
| 288 | |
| 289 | var tmp gather.WriteBuffer |
| 290 | defer tmp.Close() |
| 291 | |
| 292 | called := false |
| 293 | |
| 294 | dummyError := errors.New("dummy error") |
| 295 | |
| 296 | require.ErrorIs(t, pc.GetOrLoad(ctx, "key", func(output *gather.WriteBuffer) error { |
| 297 | called = true |
| 298 | return dummyError |
| 299 | }, &tmp), dummyError) |
| 300 | |
| 301 | require.True(t, called) |
| 302 | } |
| 303 | |
| 304 | func TestPersistentLRUCache_Defaults(t *testing.T) { |
| 305 | cacheDir := testutil.TempDirectory(t) |
nothing calls this directly
no test coverage detected