dnfjson: Adjust cache size info for new layout

The repo id hash directories are now down one level, below a directory
named for the distribution.
This commit is contained in:
Brian C. Lane 2023-03-01 16:25:22 -08:00 committed by Achilleas Koutsou
parent 3481e1d3ba
commit 8f20b550ea
3 changed files with 32 additions and 12 deletions

View file

@ -157,8 +157,10 @@ func TestCacheRead(t *testing.T) {
for name, cfg := range testCfgs {
t.Run(name, func(t *testing.T) {
testCacheRoot := t.TempDir()
s := createTestCache(testCacheRoot, cfg)
// Cache is now per-distro, use the name of the config as a distro name
s := createTestCache(filepath.Join(testCacheRoot, name), cfg)
// Cache covers all distros, pass in top directory
cache := newRPMCache(testCacheRoot, 1048576) // 1 MiB, but doesn't matter for this test
nrepos := len(getRepoIDs(cfg))
@ -259,8 +261,12 @@ func TestCacheCleanup(t *testing.T) {
t.Run(name, func(t *testing.T) {
assert := assert.New(t)
testCacheRoot := t.TempDir()
createTestCache(testCacheRoot, cfg.cache)
// Cache is now per-distro, use the name of the config as a distro name
createTestCache(filepath.Join(testCacheRoot, name), cfg.cache)
// Cache covers all distros, pass in top directory
cache := newRPMCache(testCacheRoot, cfg.maxSize)
err := cache.shrink()
assert.NoError(err)