mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Merge pull request #51227 from vvoland/client-image-opts
client/image: Wrap result and options in structs
This commit is contained in:
@@ -94,10 +94,10 @@ func getAllContainers(ctx context.Context, t testing.TB, apiClient client.Contai
|
||||
|
||||
func deleteAllImages(ctx context.Context, t testing.TB, apiclient client.ImageAPIClient, protectedImages map[string]struct{}) {
|
||||
t.Helper()
|
||||
images, err := apiclient.ImageList(ctx, client.ImageListOptions{})
|
||||
imageList, err := apiclient.ImageList(ctx, client.ImageListOptions{})
|
||||
assert.Check(t, err, "failed to list images")
|
||||
|
||||
for _, img := range images {
|
||||
for _, img := range imageList.Items {
|
||||
tags := tagsFromImageSummary(img)
|
||||
if _, ok := protectedImages[img.ID]; ok {
|
||||
continue
|
||||
|
||||
@@ -205,7 +205,7 @@ func (e *Execution) HasExistingImage(t testing.TB, reference string) bool {
|
||||
})
|
||||
assert.NilError(t, err, "failed to list images")
|
||||
|
||||
return len(imageList) > 0
|
||||
return len(imageList.Items) > 0
|
||||
}
|
||||
|
||||
// EnsureFrozenImagesLinux loads frozen test images into the daemon
|
||||
|
||||
@@ -121,7 +121,7 @@ func getExistingImages(ctx context.Context, t testing.TB, testEnv *Execution) []
|
||||
assert.NilError(t, err, "failed to list images")
|
||||
|
||||
var images []string
|
||||
for _, img := range imageList {
|
||||
for _, img := range imageList.Items {
|
||||
images = append(images, tagsFromImageSummary(img)...)
|
||||
}
|
||||
return images
|
||||
|
||||
@@ -70,7 +70,7 @@ func FrozenImagesLinux(ctx context.Context, apiClient client.APIClient, images .
|
||||
|
||||
for _, img := range loadImages {
|
||||
if img.srcName != img.destName {
|
||||
if err := apiClient.ImageTag(ctx, img.srcName, img.destName); err != nil {
|
||||
if _, err := apiClient.ImageTag(ctx, client.ImageTagOptions{Source: img.srcName, Target: img.destName}); err != nil {
|
||||
return errors.Wrapf(err, "failed to tag %s as %s", img.srcName, img.destName)
|
||||
}
|
||||
if _, err := apiClient.ImageRemove(ctx, img.srcName, client.ImageRemoveOptions{}); err != nil {
|
||||
@@ -171,7 +171,7 @@ func pullTagAndRemove(ctx context.Context, apiClient client.APIClient, ref strin
|
||||
return err
|
||||
}
|
||||
|
||||
if err := apiClient.ImageTag(ctx, ref, tag); err != nil {
|
||||
if _, err := apiClient.ImageTag(ctx, client.ImageTagOptions{Source: ref, Target: tag}); err != nil {
|
||||
return errors.Wrapf(err, "failed to tag %s as %s", ref, tag)
|
||||
}
|
||||
_, err = apiClient.ImageRemove(ctx, ref, client.ImageRemoveOptions{})
|
||||
|
||||
Reference in New Issue
Block a user