MCPcopy Create free account
hub / github.com/containers/image / TestSplitHTTP200ResponseToPartial

Function TestSplitHTTP200ResponseToPartial

docker/docker_image_src_test.go:130–148  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

128}
129
130func TestSplitHTTP200ResponseToPartial(t *testing.T) {
131 body := io.NopCloser(bytes.NewReader([]byte("123456789")))
132 defer body.Close()
133 streams := make(chan io.ReadCloser)
134 errs := make(chan error)
135 chunks := []private.ImageSourceChunk{
136 {Offset: 1, Length: 2},
137 {Offset: 4, Length: 1},
138 }
139 go splitHTTP200ResponseToPartial(streams, errs, body, chunks)
140
141 expected := []verifyGetBlobAtData{
142 {[]byte("23"), nil},
143 {[]byte("5"), nil},
144 {[]byte(nil), nil},
145 }
146
147 verifyGetBlobAtOutput(t, streams, errs, expected)
148}
149
150func TestHandle206Response(t *testing.T) {
151 body := io.NopCloser(bytes.NewReader([]byte("--AAA\r\n\r\n23\r\n--AAA\r\n\r\n5\r\n--AAA--")))

Callers

nothing calls this directly

Calls 3

verifyGetBlobAtOutputFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…