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

Function TestFileStorage_Init

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

Source from the content-addressed store, hash-verified

19)
20
21func TestFileStorage_Init(t *testing.T) {
22 if !testutils.IsSingleTesting() {
23 return
24 }
25
26 var storage = NewFileStorage(&serverconfigs.HTTPCachePolicy{
27 Id: 1,
28 IsOn: true,
29 Options: map[string]interface{}{
30 "dir": Tea.Root + "/caches",
31 },
32 })
33
34 defer storage.Stop()
35
36 err := storage.Init()
37 if err != nil {
38 t.Fatal(err)
39 }
40 //t.Log(storage.list.m)
41
42 /**err = storage.Write("c", bytes.NewReader([]byte("i am c")), 4, "second")
43 if err != nil {
44 t.Fatal(err)
45 }**/
46 //logs.PrintAsJSON(storage.list.m, t)
47
48 time.Sleep(2 * time.Second)
49 storage.purgeLoop()
50 t.Log(storage.list.(*SQLiteFileList).Stat(func(hash string) bool {
51 return true
52 }))
53}
54
55func TestFileStorage_OpenWriter(t *testing.T) {
56 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
StatMethod · 0.65
purgeLoopMethod · 0.45

Tested by

no test coverage detected