mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client: Change ImageLoad to use functional options
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/errdefs"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"gotest.tools/v3/assert"
|
||||
@@ -20,7 +19,7 @@ func TestImageLoadError(t *testing.T) {
|
||||
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
|
||||
}
|
||||
|
||||
_, err := client.ImageLoad(context.Background(), nil, image.LoadOptions{Quiet: true})
|
||||
_, err := client.ImageLoad(context.Background(), nil, ImageLoadWithQuiet(true))
|
||||
assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
|
||||
}
|
||||
|
||||
@@ -97,10 +96,10 @@ func TestImageLoad(t *testing.T) {
|
||||
}
|
||||
|
||||
input := bytes.NewReader([]byte(expectedInput))
|
||||
imageLoadResponse, err := client.ImageLoad(context.Background(), input, image.LoadOptions{
|
||||
Quiet: tc.quiet,
|
||||
Platforms: tc.platforms,
|
||||
})
|
||||
imageLoadResponse, err := client.ImageLoad(context.Background(), input,
|
||||
ImageLoadWithQuiet(tc.quiet),
|
||||
ImageLoadWithPlatforms(tc.platforms...),
|
||||
)
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Equal(imageLoadResponse.JSON, tc.expectedResponseJSON))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user