MCPcopy Create free account
hub / github.com/PostHog/duckgres / tmpDirEntries

Function tmpDirEntries

cmd/cache-proxy/cache_test.go:204–211  ·  view source on GitHub ↗

tmpDirEntries counts the files left behind in the cache's .tmp subdir, so tests can assert PutStream never leaks a temp file.

(t *testing.T, c *DiskCache)

Source from the content-addressed store, hash-verified

202 if _, err := c.PutStream(bad, bytes.NewReader([]byte("x"))); err == nil {
203 t.Error("PutStream should reject invalid key")
204 }
205}
206
207// TestDiskCacheEviction exercises LRU eviction when the cache fills up.
208// We set maxBytes tiny by construction: NewDiskCache uses statfs * percent,
209// so we directly mutate the cache after construction for a predictable test.
210func TestDiskCacheEviction(t *testing.T) {
211 c := newTestCache(t)
212 // Force the eviction threshold low so we trigger it quickly.
213 c.maxBytes = 100
214

Callers 2

TestPutStreamRoundTripFunction · 0.85

Calls 1

readDirNamesFunction · 0.85

Tested by

no test coverage detected