MCPcopy
hub / github.com/keploy/keploy / TestReadChunkBlocksThenReturns

Function TestReadChunkBlocksThenReturns

pkg/agent/proxy/fakeconn/fakeconn_test.go:133–148  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

131}
132
133func TestReadChunkBlocksThenReturns(t *testing.T) {
134 t.Parallel()
135 ch := make(chan Chunk)
136 f := New(ch, nil, nil)
137 go func() {
138 time.Sleep(10 * time.Millisecond)
139 ch <- Chunk{Dir: FromDest, Bytes: []byte("hi"), ReadAt: time.Unix(5, 0)}
140 }()
141 c, err := f.ReadChunk()
142 if err != nil {
143 t.Fatalf("ReadChunk: %v", err)
144 }
145 if string(c.Bytes) != "hi" {
146 t.Errorf("got %q, want %q", c.Bytes, "hi")
147 }
148}
149
150func TestReadAfterCloseReturnsErrClosed(t *testing.T) {
151 t.Parallel()

Callers

nothing calls this directly

Calls 2

ReadChunkMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected