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

Function TestParseRegistryWarningHeader

docker/docker_client_test.go:319–339  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

317}
318
319func TestParseRegistryWarningHeader(t *testing.T) {
320 for _, c := range []struct{ header, expected string }{
321 {"completely invalid", ""},
322 {`299 - "trivial"`, "trivial"},
323 {`100 - "not-299"`, ""},
324 {`299 localhost "warn-agent set"`, ""},
325 {`299 - "no-terminating-quote`, ""},
326 {"299 - \"\x01 control\"", ""},
327 {"299 - \"\\\x01 escaped control\"", ""},
328 {"299 - \"e\\scaped\"", "escaped"},
329 {"299 - \"non-UTF8 \xA1\xA2\"", "non-UTF8 \xA1\xA2"},
330 {"299 - \"non-UTF8 escaped \\\xA1\\\xA2\"", "non-UTF8 escaped \xA1\xA2"},
331 {"299 - \"UTF8 žluťoučký\"", "UTF8 žluťoučký"},
332 {"299 - \"UTF8 \\\xC5\\\xBEluťoučký\"", "UTF8 žluťoučký"},
333 {`299 - "unterminated`, ""},
334 {`299 - "warning" "some-date"`, ""},
335 } {
336 res := parseRegistryWarningHeader(c.header)
337 assert.Equal(t, c.expected, res, c.header)
338 }
339}
340
341func TestGetBlobSize(t *testing.T) {
342 for _, c := range []struct {

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…