Test that the default cache_max_bytes counts what the cache holds
With a fake free-space probe, an empty cache with 4 GiB free gets a 3 GiB default, and the same cache once it holds those 3 GiB, with 1 GiB left free, must keep 3 GiB. The default is still 75% of the free space alone, so the second check fails: this is the bug in #184. computeDefaultMaxBytes only calls the config's existing computation so the test compiles. Model: opus-5-5
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package imgcache
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path/filepath"
|
||||
|
||||
"sneak.berlin/go/pixa/internal/config"
|
||||
)
|
||||
|
||||
// computeDefaultMaxBytes returns the default cache size limit for an
|
||||
// omitted cache_max_bytes, for the filesystem holding <state_dir>/cache/.
|
||||
func (c *Cache) computeDefaultMaxBytes(
|
||||
_ context.Context, probe config.FreeSpaceProbeFunc,
|
||||
) (int64, error) {
|
||||
return config.ComputeDefaultCacheMaxBytes(
|
||||
filepath.Join(c.config.StateDir, "cache"), probe)
|
||||
}
|
||||
Reference in New Issue
Block a user