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

Function TestFS_OpenFileReader

internal/utils/bfs/fs_test.go:63–86  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

61}
62
63func TestFS_OpenFileReader(t *testing.T) {
64 fs, openErr := bfs.OpenFS(Tea.Root+"/data/bfs/test", bfs.DefaultFSOptions)
65 if openErr != nil {
66 t.Fatal(openErr)
67 }
68 defer func() {
69 _ = fs.Close()
70 }()
71
72 reader, err := fs.OpenFileReader(bfs.Hash("123456"), false)
73 if err != nil {
74 if bfs.IsNotExist(err) {
75 t.Log(err)
76 return
77 }
78 t.Fatal(err)
79 }
80 data, err := io.ReadAll(reader)
81 if err != nil {
82 t.Fatal(err)
83 }
84 t.Log(string(data))
85 logs.PrintAsJSON(reader.FileHeader(), t)
86}
87
88func TestFS_ExistFile(t *testing.T) {
89 fs, openErr := bfs.OpenFS(Tea.Root+"/data/bfs/test", bfs.DefaultFSOptions)

Callers

nothing calls this directly

Calls 7

OpenFSFunction · 0.92
HashFunction · 0.92
IsNotExistFunction · 0.92
LogMethod · 0.80
CloseMethod · 0.65
OpenFileReaderMethod · 0.45
FileHeaderMethod · 0.45

Tested by

no test coverage detected