MCPcopy Index your code
hub / github.com/GoEdgeLab/EdgeNode / TestFileStorage_CleanAll

Function TestFileStorage_CleanAll

internal/caches/storage_file_test.go:546–582  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

544}
545
546func TestFileStorage_CleanAll(t *testing.T) {
547 if !testutils.IsSingleTesting() {
548 return
549 }
550
551 var storage = NewFileStorage(&serverconfigs.HTTPCachePolicy{
552 Id: 1,
553 IsOn: true,
554 Options: map[string]interface{}{
555 "dir": Tea.Root + "/caches",
556 },
557 })
558
559 defer storage.Stop()
560
561 err := storage.Init()
562 if err != nil {
563 t.Fatal(err)
564 }
565
566 before := time.Now()
567 defer func() {
568 t.Log(time.Since(before).Seconds()*1000, "ms")
569 }()
570
571 c, _ := storage.list.Count()
572 t.Log("before:", c)
573
574 err = storage.CleanAll()
575 if err != nil {
576 t.Fatal(err)
577 }
578
579 c, _ = storage.list.Count()
580 t.Log("after:", c)
581 t.Log("ok")
582}
583
584func TestFileStorage_Stop(t *testing.T) {
585 if !testutils.IsSingleTesting() {

Callers

nothing calls this directly

Calls 7

IsSingleTestingFunction · 0.92
NewFileStorageFunction · 0.85
LogMethod · 0.80
StopMethod · 0.65
InitMethod · 0.65
CountMethod · 0.65
CleanAllMethod · 0.65

Tested by

no test coverage detected