(t *testing.T)
| 302 | } |
| 303 | |
| 304 | func TestPersistentLRUCache_Defaults(t *testing.T) { |
| 305 | cacheDir := testutil.TempDirectory(t) |
| 306 | ctx := testlogging.ContextWithLevel(t, testlogging.LevelInfo) |
| 307 | |
| 308 | const maxSizeBytes = 1000 |
| 309 | |
| 310 | cs, err := cache.NewStorageOrNil(ctx, cacheDir, maxSizeBytes, "subdir") |
| 311 | require.NoError(t, err) |
| 312 | |
| 313 | pc, err := cache.NewPersistentCache(ctx, "testing", cs, nil, cache.SweepSettings{ |
| 314 | MaxSizeBytes: maxSizeBytes, |
| 315 | }, nil, clock.Now) |
| 316 | require.NoError(t, err) |
| 317 | |
| 318 | defer pc.Close(ctx) |
| 319 | |
| 320 | pc.Put(ctx, "key1", gather.FromSlice([]byte{1, 2, 3})) |
| 321 | verifyCached(ctx, t, pc, "key1", []byte{1, 2, 3}) |
| 322 | } |
| 323 | |
| 324 | func verifyCached(ctx context.Context, t *testing.T, pc *cache.PersistentCache, key string, want []byte) { |
| 325 | t.Helper() |
nothing calls this directly
no test coverage detected