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

Function TestFileList_Purge

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

Source from the content-addressed store, hash-verified

272}
273
274func TestFileList_Purge(t *testing.T) {
275 if !testutils.IsSingleTesting() {
276 return
277 }
278
279 var list = caches.NewSQLiteFileList(Tea.Root + "/data/cache-index/p1")
280
281 defer func() {
282 _ = list.Close()
283 }()
284
285 err := list.Init()
286 if err != nil {
287 t.Fatal(err)
288 }
289
290 var count = 0
291 _, err = list.Purge(caches.CountFileDB*2, func(hash string) error {
292 t.Log(hash)
293 count++
294 return nil
295 })
296 if err != nil {
297 t.Fatal(err)
298 }
299 t.Log("ok, purged", count, "items")
300}
301
302func TestFileList_PurgeLFU(t *testing.T) {
303 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
PurgeMethod · 0.65

Tested by

no test coverage detected