mirror of
https://github.com/containers/skopeo.git
synced 2025-09-10 11:09:47 +00:00
proxy: Add GetLayerInfoPiped
I was experimenting with images with lots of layers (> 200) and this invocation was incorrectly adding the entire response into what was intended as the metadata plane. `GetManifest` and `GetConfig` (even those are relatively small) still always return their data over a pipe, same as blobs. Add a new `GetLayerInfoPiped` that does the same so we can easily get this information for images with a lot of layers. Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
@@ -229,7 +229,8 @@ type byteFetch struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func runTestGetManifestAndConfig(p *proxy, img string) error {
|
||||
// This exercises all the metadata fetching APIs.
|
||||
func runTestMetadataAPIs(p *proxy, img string) error {
|
||||
v, err := p.callNoFd("OpenImage", []any{img})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -291,6 +292,19 @@ func runTestGetManifestAndConfig(p *proxy, img string) error {
|
||||
return fmt.Errorf("No CMD or ENTRYPOINT set")
|
||||
}
|
||||
|
||||
_, layerInfoBytes, err := p.callReadAllBytes("GetLayerInfoPiped", []any{imgid})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var layerInfoBytesData []interface{}
|
||||
err = json.Unmarshal(layerInfoBytes, &layerInfoBytesData)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(layerInfoBytesData) == 0 {
|
||||
return fmt.Errorf("expected layer info data")
|
||||
}
|
||||
|
||||
// Also test this legacy interface
|
||||
_, ctrconfigBytes, err := p.callReadAllBytes("GetConfig", []any{imgid})
|
||||
if err != nil {
|
||||
@@ -337,13 +351,13 @@ func (s *proxySuite) TestProxy() {
|
||||
p, err := newProxy()
|
||||
require.NoError(t, err)
|
||||
|
||||
err = runTestGetManifestAndConfig(p, knownNotManifestListedImageX8664)
|
||||
err = runTestMetadataAPIs(p, knownNotManifestListedImageX8664)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Testing image %s: %v", knownNotManifestListedImageX8664, err)
|
||||
}
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = runTestGetManifestAndConfig(p, knownListImage)
|
||||
err = runTestMetadataAPIs(p, knownListImage)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Testing image %s: %v", knownListImage, err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user