MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / TestAsyncBufferReadAllCompability

Function TestAsyncBufferReadAllCompability

asyncbuffer/buffer_test.go:430–439  ·  view source on GitHub ↗

TestAsyncBufferReadAllCompability tests that ReadAll methods works as expected

(t *testing.T)

Source from the content-addressed store, hash-verified

428
429// TestAsyncBufferReadAllCompability tests that ReadAll methods works as expected
430func TestAsyncBufferReadAllCompability(t *testing.T) {
431 source, err := os.ReadFile("../testdata/test1.jpg")
432 require.NoError(t, err)
433 ab := asyncbuffer.New(newCountingReader(bytes.NewReader(source)), -1)
434 defer ab.Close()
435
436 b, err := io.ReadAll(ab.Reader())
437 require.NoError(t, err)
438 require.Len(t, b, len(source))
439}
440
441func TestAsyncBufferThreshold(t *testing.T) {
442 _, bytesReader := generateSourceData(t, asyncbuffer.PauseThreshold*3)

Callers

nothing calls this directly

Calls 5

NewFunction · 0.92
newCountingReaderFunction · 0.85
CloseMethod · 0.65
ReaderMethod · 0.65
LenMethod · 0.45

Tested by

no test coverage detected