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

Function TestFileReader_Pool

internal/utils/bfs/file_reader_test.go:208–237  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

206}
207
208func TestFileReader_Pool(t *testing.T) {
209 bFile, openErr := bfs.OpenBlocksFile("testdata/test.b", bfs.DefaultBlockFileOptions)
210 if openErr != nil {
211 if os.IsNotExist(openErr) {
212 t.Log(openErr)
213 return
214 }
215 t.Fatal(openErr)
216 }
217
218 for i := 0; i < 10; i++ {
219 reader, err := bFile.OpenFileReader(bfs.Hash("123456"), false)
220 if err != nil {
221 if os.IsNotExist(err) {
222 continue
223 }
224 t.Fatal(err)
225 }
226
227 go func() {
228 err = reader.Close()
229 if err != nil {
230 t.Log(err)
231 }
232 }()
233 }
234
235 time.Sleep(100 * time.Millisecond)
236 t.Log(len(bFile.TestReaderPool()))
237}

Callers

nothing calls this directly

Calls 6

OpenBlocksFileFunction · 0.92
HashFunction · 0.92
LogMethod · 0.80
TestReaderPoolMethod · 0.80
CloseMethod · 0.65
OpenFileReaderMethod · 0.45

Tested by

no test coverage detected