api/types/image: move image option types to client

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
This commit is contained in:
Austin Vazquez
2025-08-20 10:28:23 -05:00
parent 531be96bf9
commit 853aed171b
77 changed files with 512 additions and 487 deletions

View File

@@ -23,7 +23,7 @@ func TestImageListError(t *testing.T) {
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
}
_, err := client.ImageList(context.Background(), image.ListOptions{})
_, err := client.ImageList(context.Background(), ImageListOptions{})
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
}
@@ -35,7 +35,7 @@ func TestImageListConnectionError(t *testing.T) {
client, err := NewClientWithOpts(WithAPIVersionNegotiation(), WithHost("tcp://no-such-host.invalid"))
assert.NilError(t, err)
_, err = client.ImageList(context.Background(), image.ListOptions{})
_, err = client.ImageList(context.Background(), ImageListOptions{})
assert.Check(t, is.ErrorType(err, IsErrConnectionFailed))
}
@@ -43,11 +43,11 @@ func TestImageList(t *testing.T) {
const expectedURL = "/images/json"
listCases := []struct {
options image.ListOptions
options ImageListOptions
expectedQueryParams map[string]string
}{
{
options: image.ListOptions{},
options: ImageListOptions{},
expectedQueryParams: map[string]string{
"all": "",
"filter": "",
@@ -55,7 +55,7 @@ func TestImageList(t *testing.T) {
},
},
{
options: image.ListOptions{
options: ImageListOptions{
Filters: filters.NewArgs(
filters.Arg("label", "label1"),
filters.Arg("label", "label2"),
@@ -69,7 +69,7 @@ func TestImageList(t *testing.T) {
},
},
{
options: image.ListOptions{
options: ImageListOptions{
Filters: filters.NewArgs(filters.Arg("dangling", "false")),
},
expectedQueryParams: map[string]string{
@@ -148,7 +148,7 @@ func TestImageListApiBefore125(t *testing.T) {
version: "1.24",
}
options := image.ListOptions{
options := ImageListOptions{
Filters: filters.NewArgs(filters.Arg("reference", "image:tag")),
}
@@ -165,12 +165,12 @@ func TestImageListWithSharedSize(t *testing.T) {
for _, tc := range []struct {
name string
version string
options image.ListOptions
options ImageListOptions
sharedSize string // expected value for the shared-size query param, or empty if it should not be set.
}{
{name: "unset after 1.42, no options set", version: "1.42"},
{name: "set after 1.42, if requested", version: "1.42", options: image.ListOptions{SharedSize: true}, sharedSize: "1"},
{name: "unset before 1.42, even if requested", version: "1.41", options: image.ListOptions{SharedSize: true}},
{name: "set after 1.42, if requested", version: "1.42", options: ImageListOptions{SharedSize: true}, sharedSize: "1"},
{name: "unset before 1.42, even if requested", version: "1.41", options: ImageListOptions{SharedSize: true}},
} {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()