MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestFileList_PurgeLFU

Function TestFileList_PurgeLFU

internal/caches/list_file_sqlite_test.go:302–328  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

300}
301
302func TestFileList_PurgeLFU(t *testing.T) {
303 if !testutils.IsSingleTesting() {
304 return
305 }
306
307 var list = caches.NewSQLiteFileList(Tea.Root + "/data/cache-index/p1")
308
309 defer func() {
310 _ = list.Close()
311 }()
312
313 err := list.Init()
314 if err != nil {
315 t.Fatal(err)
316 }
317
318 var count = 0
319 err = list.PurgeLFU(caches.CountFileDB*2, func(hash string) error {
320 t.Log(hash)
321 count++
322 return nil
323 })
324 if err != nil {
325 t.Fatal(err)
326 }
327 t.Log("ok, purged", count, "items")
328}
329
330func TestFileList_Stat(t *testing.T) {
331 if !testutils.IsSingleTesting() {

Callers

nothing calls this directly

Calls 6

IsSingleTestingFunction · 0.92
NewSQLiteFileListFunction · 0.92
LogMethod · 0.80
CloseMethod · 0.65
InitMethod · 0.65
PurgeLFUMethod · 0.65

Tested by

no test coverage detected