(t *testing.T)
| 150 | } |
| 151 | |
| 152 | func TestDiskContentCache(t *testing.T) { |
| 153 | ctx := testlogging.Context(t) |
| 154 | |
| 155 | tmpDir := testutil.TempDirectory(t) |
| 156 | |
| 157 | const maxBytes = 10000 |
| 158 | |
| 159 | cacheStorage, err := cache.NewStorageOrNil(ctx, tmpDir, maxBytes, "contents") |
| 160 | require.NoError(t, err) |
| 161 | |
| 162 | cc, err := cache.NewContentCache(ctx, newUnderlyingStorageForContentCacheTesting(t), cache.Options{ |
| 163 | Storage: cacheStorage, |
| 164 | Sweep: cache.SweepSettings{ |
| 165 | MaxSizeBytes: maxBytes, |
| 166 | }, |
| 167 | }, nil) |
| 168 | require.NoError(t, err) |
| 169 | |
| 170 | defer cc.Close(ctx) |
| 171 | |
| 172 | verifyContentCache(t, cc, cacheStorage) |
| 173 | } |
| 174 | |
| 175 | func verifyContentCache(t *testing.T, cc cache.ContentCache, cacheStorage cache.Storage) { |
| 176 | t.Helper() |
nothing calls this directly
no test coverage detected