Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
| ... | ... |
@@ -13,12 +13,12 @@ import ( |
| 13 | 13 |
"testing" |
| 14 | 14 |
"time" |
| 15 | 15 |
|
| 16 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 16 | 17 |
"github.com/docker/docker/api/types/build" |
| 17 | 18 |
"github.com/docker/docker/api/types/container" |
| 18 | 19 |
"github.com/docker/docker/api/types/events" |
| 19 | 20 |
"github.com/docker/docker/api/types/filters" |
| 20 | 21 |
"github.com/docker/docker/api/types/image" |
| 21 |
- "github.com/docker/docker/errdefs" |
|
| 22 | 22 |
"github.com/docker/docker/pkg/jsonmessage" |
| 23 | 23 |
"github.com/docker/docker/testutil" |
| 24 | 24 |
"github.com/docker/docker/testutil/fakecontext" |
| ... | ... |
@@ -690,7 +690,7 @@ func TestBuildPlatformInvalid(t *testing.T) {
|
| 690 | 690 |
}) |
| 691 | 691 |
|
| 692 | 692 |
assert.Check(t, is.ErrorContains(err, "unknown operating system or architecture")) |
| 693 |
- assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter)) |
|
| 693 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument)) |
|
| 694 | 694 |
} |
| 695 | 695 |
|
| 696 | 696 |
// TestBuildWorkdirNoCacheMiss is a regression test for https://github.com/moby/moby/issues/47627 |
| ... | ... |
@@ -8,11 +8,11 @@ import ( |
| 8 | 8 |
"testing" |
| 9 | 9 |
"time" |
| 10 | 10 |
|
| 11 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 11 | 12 |
"github.com/docker/docker/api/types/container" |
| 12 | 13 |
"github.com/docker/docker/api/types/filters" |
| 13 | 14 |
swarmtypes "github.com/docker/docker/api/types/swarm" |
| 14 | 15 |
"github.com/docker/docker/client" |
| 15 |
- "github.com/docker/docker/errdefs" |
|
| 16 | 16 |
"github.com/docker/docker/integration/internal/swarm" |
| 17 | 17 |
"github.com/docker/docker/pkg/stdcopy" |
| 18 | 18 |
"github.com/docker/docker/testutil" |
| ... | ... |
@@ -147,11 +147,11 @@ func TestConfigsCreateAndDelete(t *testing.T) {
|
| 147 | 147 |
assert.NilError(t, err) |
| 148 | 148 |
|
| 149 | 149 |
_, _, err = c.ConfigInspectWithRaw(ctx, configID) |
| 150 |
- assert.Check(t, errdefs.IsNotFound(err)) |
|
| 150 |
+ assert.Check(t, cerrdefs.IsNotFound(err)) |
|
| 151 | 151 |
assert.Check(t, is.ErrorContains(err, configID)) |
| 152 | 152 |
|
| 153 | 153 |
err = c.ConfigRemove(ctx, "non-existing") |
| 154 |
- assert.Check(t, errdefs.IsNotFound(err)) |
|
| 154 |
+ assert.Check(t, cerrdefs.IsNotFound(err)) |
|
| 155 | 155 |
assert.Check(t, is.ErrorContains(err, "non-existing")) |
| 156 | 156 |
|
| 157 | 157 |
testName = "test_secret_with_labels_" + t.Name() |
| ... | ... |
@@ -216,7 +216,7 @@ func TestConfigsUpdate(t *testing.T) {
|
| 216 | 216 |
// this test will produce an error in func UpdateConfig |
| 217 | 217 |
insp.Spec.Data = []byte("TESTINGDATA2")
|
| 218 | 218 |
err = c.ConfigUpdate(ctx, configID, insp.Version, insp.Spec) |
| 219 |
- assert.Check(t, errdefs.IsInvalidParameter(err)) |
|
| 219 |
+ assert.Check(t, cerrdefs.IsInvalidArgument(err)) |
|
| 220 | 220 |
assert.Check(t, is.ErrorContains(err, "only updates to Labels are allowed")) |
| 221 | 221 |
} |
| 222 | 222 |
|
| ... | ... |
@@ -11,9 +11,9 @@ import ( |
| 11 | 11 |
"strings" |
| 12 | 12 |
"testing" |
| 13 | 13 |
|
| 14 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 14 | 15 |
"github.com/docker/docker/api/types/build" |
| 15 | 16 |
containertypes "github.com/docker/docker/api/types/container" |
| 16 |
- "github.com/docker/docker/errdefs" |
|
| 17 | 17 |
"github.com/docker/docker/integration/internal/container" |
| 18 | 18 |
"github.com/docker/docker/pkg/jsonmessage" |
| 19 | 19 |
"github.com/docker/docker/testutil/fakecontext" |
| ... | ... |
@@ -30,7 +30,7 @@ func TestCopyFromContainerPathDoesNotExist(t *testing.T) {
|
| 30 | 30 |
cid := container.Create(ctx, t, apiClient) |
| 31 | 31 |
|
| 32 | 32 |
_, _, err := apiClient.CopyFromContainer(ctx, cid, "/dne") |
| 33 |
- assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) |
|
| 33 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
|
| 34 | 34 |
assert.Check(t, is.ErrorContains(err, "Could not find the file /dne in container "+cid)) |
| 35 | 35 |
} |
| 36 | 36 |
|
| ... | ... |
@@ -58,7 +58,7 @@ func TestCopyToContainerPathDoesNotExist(t *testing.T) {
|
| 58 | 58 |
cid := container.Create(ctx, t, apiClient) |
| 59 | 59 |
|
| 60 | 60 |
err := apiClient.CopyToContainer(ctx, cid, "/dne", nil, containertypes.CopyToContainerOptions{})
|
| 61 |
- assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) |
|
| 61 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
|
| 62 | 62 |
assert.Check(t, is.ErrorContains(err, "Could not find the file /dne in container "+cid)) |
| 63 | 63 |
} |
| 64 | 64 |
|
| ... | ... |
@@ -11,11 +11,11 @@ import ( |
| 11 | 11 |
"time" |
| 12 | 12 |
|
| 13 | 13 |
containerd "github.com/containerd/containerd/v2/client" |
| 14 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 14 | 15 |
"github.com/docker/docker/api/types/container" |
| 15 | 16 |
"github.com/docker/docker/api/types/network" |
| 16 | 17 |
"github.com/docker/docker/api/types/versions" |
| 17 | 18 |
"github.com/docker/docker/client" |
| 18 |
- "github.com/docker/docker/errdefs" |
|
| 19 | 19 |
testContainer "github.com/docker/docker/integration/internal/container" |
| 20 | 20 |
net "github.com/docker/docker/integration/internal/network" |
| 21 | 21 |
"github.com/docker/docker/oci" |
| ... | ... |
@@ -66,7 +66,7 @@ func TestCreateFailsWhenIdentifierDoesNotExist(t *testing.T) {
|
| 66 | 66 |
"", |
| 67 | 67 |
) |
| 68 | 68 |
assert.Check(t, is.ErrorContains(err, tc.expectedError)) |
| 69 |
- assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) |
|
| 69 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
|
| 70 | 70 |
}) |
| 71 | 71 |
} |
| 72 | 72 |
} |
| ... | ... |
@@ -104,13 +104,13 @@ func TestCreateByImageID(t *testing.T) {
|
| 104 | 104 |
{
|
| 105 | 105 |
doc: "image with ID and algorithm as tag", |
| 106 | 106 |
image: "busybox:" + imgIDWithAlgorithm, |
| 107 |
- expectedErrType: errdefs.IsInvalidParameter, |
|
| 107 |
+ expectedErrType: cerrdefs.IsInvalidArgument, |
|
| 108 | 108 |
expectedErr: "Error response from daemon: invalid reference format", |
| 109 | 109 |
}, |
| 110 | 110 |
{
|
| 111 | 111 |
doc: "image with ID as tag", |
| 112 | 112 |
image: "busybox:" + imgID, |
| 113 |
- expectedErrType: errdefs.IsNotFound, |
|
| 113 |
+ expectedErrType: cerrdefs.IsNotFound, |
|
| 114 | 114 |
expectedErr: "Error response from daemon: No such image: busybox:" + imgID, |
| 115 | 115 |
}, |
| 116 | 116 |
} |
| ... | ... |
@@ -160,7 +160,7 @@ func TestCreateLinkToNonExistingContainer(t *testing.T) {
|
| 160 | 160 |
"", |
| 161 | 161 |
) |
| 162 | 162 |
assert.Check(t, is.ErrorContains(err, "could not get container for no-such-container")) |
| 163 |
- assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter)) |
|
| 163 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument)) |
|
| 164 | 164 |
} |
| 165 | 165 |
|
| 166 | 166 |
func TestCreateWithInvalidEnv(t *testing.T) {
|
| ... | ... |
@@ -200,7 +200,7 @@ func TestCreateWithInvalidEnv(t *testing.T) {
|
| 200 | 200 |
"", |
| 201 | 201 |
) |
| 202 | 202 |
assert.Check(t, is.ErrorContains(err, tc.expectedError)) |
| 203 |
- assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter)) |
|
| 203 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument)) |
|
| 204 | 204 |
}) |
| 205 | 205 |
} |
| 206 | 206 |
} |
| ... | ... |
@@ -247,7 +247,7 @@ func TestCreateTmpfsMountsTarget(t *testing.T) {
|
| 247 | 247 |
"", |
| 248 | 248 |
) |
| 249 | 249 |
assert.Check(t, is.ErrorContains(err, tc.expectedError)) |
| 250 |
- assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter)) |
|
| 250 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument)) |
|
| 251 | 251 |
} |
| 252 | 252 |
} |
| 253 | 253 |
|
| ... | ... |
@@ -502,7 +502,7 @@ func TestCreateWithInvalidHealthcheckParams(t *testing.T) {
|
| 502 | 502 |
|
| 503 | 503 |
resp, err := apiClient.ContainerCreate(ctx, &cfg, &container.HostConfig{}, nil, nil, "")
|
| 504 | 504 |
assert.Check(t, is.Equal(len(resp.Warnings), 0)) |
| 505 |
- assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter)) |
|
| 505 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument)) |
|
| 506 | 506 |
assert.ErrorContains(t, err, tc.expectedErr) |
| 507 | 507 |
}) |
| 508 | 508 |
} |
| ... | ... |
@@ -572,7 +572,7 @@ func TestCreateDifferentPlatform(t *testing.T) {
|
| 572 | 572 |
Variant: img.Variant, |
| 573 | 573 |
} |
| 574 | 574 |
_, err := apiClient.ContainerCreate(ctx, &container.Config{Image: "busybox:latest"}, &container.HostConfig{}, nil, &p, "")
|
| 575 |
- assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) |
|
| 575 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
|
| 576 | 576 |
}) |
| 577 | 577 |
t.Run("different cpu arch", func(t *testing.T) {
|
| 578 | 578 |
ctx := testutil.StartSpan(ctx, t) |
| ... | ... |
@@ -582,7 +582,7 @@ func TestCreateDifferentPlatform(t *testing.T) {
|
| 582 | 582 |
Variant: img.Variant, |
| 583 | 583 |
} |
| 584 | 584 |
_, err := apiClient.ContainerCreate(ctx, &container.Config{Image: "busybox:latest"}, &container.HostConfig{}, nil, &p, "")
|
| 585 |
- assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) |
|
| 585 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
|
| 586 | 586 |
}) |
| 587 | 587 |
} |
| 588 | 588 |
|
| ... | ... |
@@ -598,7 +598,7 @@ func TestCreateVolumesFromNonExistingContainer(t *testing.T) {
|
| 598 | 598 |
nil, |
| 599 | 599 |
"", |
| 600 | 600 |
) |
| 601 |
- assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter)) |
|
| 601 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument)) |
|
| 602 | 602 |
} |
| 603 | 603 |
|
| 604 | 604 |
// Test that we can create a container from an image that is for a different platform even if a platform was not specified |
| ... | ... |
@@ -673,7 +673,7 @@ func TestCreateInvalidHostConfig(t *testing.T) {
|
| 673 | 673 |
} |
| 674 | 674 |
resp, err := apiClient.ContainerCreate(ctx, &cfg, &tc.hc, nil, nil, "") |
| 675 | 675 |
assert.Check(t, is.Equal(len(resp.Warnings), 0)) |
| 676 |
- assert.Check(t, errdefs.IsInvalidParameter(err), "got: %T", err) |
|
| 676 |
+ assert.Check(t, cerrdefs.IsInvalidArgument(err), "got: %T", err) |
|
| 677 | 677 |
assert.Error(t, err, tc.expectedErr) |
| 678 | 678 |
}) |
| 679 | 679 |
} |
| ... | ... |
@@ -10,9 +10,9 @@ import ( |
| 10 | 10 |
"testing" |
| 11 | 11 |
"time" |
| 12 | 12 |
|
| 13 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 13 | 14 |
"github.com/docker/docker/api/types" |
| 14 | 15 |
containertypes "github.com/docker/docker/api/types/container" |
| 15 |
- "github.com/docker/docker/errdefs" |
|
| 16 | 16 |
"github.com/docker/docker/integration/internal/build" |
| 17 | 17 |
"github.com/docker/docker/integration/internal/container" |
| 18 | 18 |
"github.com/docker/docker/testutil/fakecontext" |
| ... | ... |
@@ -244,7 +244,7 @@ func TestExecResize(t *testing.T) {
|
| 244 | 244 |
Height: 40, |
| 245 | 245 |
Width: 40, |
| 246 | 246 |
}) |
| 247 |
- assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) |
|
| 247 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
|
| 248 | 248 |
assert.Check(t, is.ErrorContains(err, "No such exec instance: no-such-exec-id")) |
| 249 | 249 |
}) |
| 250 | 250 |
|
| ... | ... |
@@ -272,7 +272,7 @@ func TestExecResize(t *testing.T) {
|
| 272 | 272 |
Height: 40, |
| 273 | 273 |
Width: 40, |
| 274 | 274 |
}) |
| 275 |
- assert.Check(t, is.ErrorType(err, errdefs.IsConflict)) |
|
| 275 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict)) |
|
| 276 | 276 |
assert.Check(t, is.ErrorContains(err, "is not running")) |
| 277 | 277 |
}) |
| 278 | 278 |
} |
| ... | ... |
@@ -394,7 +394,7 @@ func TestExecUser(t *testing.T) {
|
| 394 | 394 |
result, err := container.Exec(ctx, apiClient, cID, []string{"id"}, withUser(tc.user))
|
| 395 | 395 |
if tc.expectedErr != "" {
|
| 396 | 396 |
assert.Check(t, is.Error(err, tc.expectedErr)) |
| 397 |
- assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter)) |
|
| 397 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument)) |
|
| 398 | 398 |
assert.Check(t, is.Equal(result.Stdout(), "<nil>")) |
| 399 | 399 |
assert.Check(t, is.Equal(result.Stderr(), "<nil>")) |
| 400 | 400 |
} else {
|
| ... | ... |
@@ -7,13 +7,13 @@ import ( |
| 7 | 7 |
"syscall" |
| 8 | 8 |
"testing" |
| 9 | 9 |
|
| 10 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 10 | 11 |
"github.com/docker/docker/api" |
| 11 | 12 |
containertypes "github.com/docker/docker/api/types/container" |
| 12 | 13 |
mounttypes "github.com/docker/docker/api/types/mount" |
| 13 | 14 |
"github.com/docker/docker/api/types/network" |
| 14 | 15 |
"github.com/docker/docker/api/types/versions" |
| 15 | 16 |
"github.com/docker/docker/client" |
| 16 |
- "github.com/docker/docker/errdefs" |
|
| 17 | 17 |
"github.com/docker/docker/integration/internal/container" |
| 18 | 18 |
"github.com/docker/docker/pkg/parsers/kernel" |
| 19 | 19 |
"github.com/docker/docker/testutil" |
| ... | ... |
@@ -435,7 +435,7 @@ func TestContainerVolumeAnonymous(t *testing.T) {
|
| 435 | 435 |
// when used, which we use as indicator that the driver was passed |
| 436 | 436 |
// through. We should have a cleaner way for this, but that would |
| 437 | 437 |
// require a custom volume plugin to be installed. |
| 438 |
- assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) |
|
| 438 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
|
| 439 | 439 |
assert.Check(t, is.ErrorContains(err, fmt.Sprintf(`plugin %q not found`, testNonExistingPlugin))) |
| 440 | 440 |
}) |
| 441 | 441 |
} |
| ... | ... |
@@ -4,8 +4,8 @@ import ( |
| 4 | 4 |
"os" |
| 5 | 5 |
"testing" |
| 6 | 6 |
|
| 7 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 7 | 8 |
containertypes "github.com/docker/docker/api/types/container" |
| 8 |
- "github.com/docker/docker/errdefs" |
|
| 9 | 9 |
"github.com/docker/docker/integration/internal/container" |
| 10 | 10 |
"gotest.tools/v3/assert" |
| 11 | 11 |
is "gotest.tools/v3/assert/cmp" |
| ... | ... |
@@ -39,7 +39,7 @@ func TestPIDModeContainer(t *testing.T) {
|
| 39 | 39 |
|
| 40 | 40 |
t.Run("non-existing container", func(t *testing.T) {
|
| 41 | 41 |
_, err := container.CreateFromConfig(ctx, apiClient, container.NewTestConfig(container.WithPIDMode("container:nosuchcontainer")))
|
| 42 |
- assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter)) |
|
| 42 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument)) |
|
| 43 | 43 |
assert.Check(t, is.ErrorContains(err, "No such container: nosuchcontainer")) |
| 44 | 44 |
}) |
| 45 | 45 |
|
| ... | ... |
@@ -51,7 +51,7 @@ func TestPIDModeContainer(t *testing.T) {
|
| 51 | 51 |
assert.NilError(t, err, "should not produce an error when creating, only when starting") |
| 52 | 52 |
|
| 53 | 53 |
err = apiClient.ContainerStart(ctx, ctr.ID, containertypes.StartOptions{})
|
| 54 |
- assert.Check(t, is.ErrorType(err, errdefs.IsSystem), "should produce a System error when starting an existing container from an invalid state") |
|
| 54 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal), "should produce a System error when starting an existing container from an invalid state") |
|
| 55 | 55 |
assert.Check(t, is.ErrorContains(err, "failed to join PID namespace")) |
| 56 | 56 |
assert.Check(t, is.ErrorContains(err, cPIDContainerID+" is not running")) |
| 57 | 57 |
}) |
| ... | ... |
@@ -4,10 +4,10 @@ import ( |
| 4 | 4 |
"os" |
| 5 | 5 |
"testing" |
| 6 | 6 |
|
| 7 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 7 | 8 |
containertypes "github.com/docker/docker/api/types/container" |
| 8 | 9 |
"github.com/docker/docker/api/types/filters" |
| 9 | 10 |
"github.com/docker/docker/api/types/volume" |
| 10 |
- "github.com/docker/docker/errdefs" |
|
| 11 | 11 |
"github.com/docker/docker/integration/internal/container" |
| 12 | 12 |
"gotest.tools/v3/assert" |
| 13 | 13 |
is "gotest.tools/v3/assert/cmp" |
| ... | ... |
@@ -46,7 +46,7 @@ func TestRemoveContainerWithRemovedVolume(t *testing.T) {
|
| 46 | 46 |
assert.NilError(t, err) |
| 47 | 47 |
|
| 48 | 48 |
_, _, err = apiClient.ContainerInspectWithRaw(ctx, cID, true) |
| 49 |
- assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) |
|
| 49 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
|
| 50 | 50 |
assert.Check(t, is.ErrorContains(err, "No such container")) |
| 51 | 51 |
} |
| 52 | 52 |
|
| ... | ... |
@@ -84,7 +84,7 @@ func TestRemoveContainerRunning(t *testing.T) {
|
| 84 | 84 |
cID := container.Run(ctx, t, apiClient) |
| 85 | 85 |
|
| 86 | 86 |
err := apiClient.ContainerRemove(ctx, cID, containertypes.RemoveOptions{})
|
| 87 |
- assert.Check(t, is.ErrorType(err, errdefs.IsConflict)) |
|
| 87 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict)) |
|
| 88 | 88 |
assert.Check(t, is.ErrorContains(err, "container is running")) |
| 89 | 89 |
} |
| 90 | 90 |
|
| ... | ... |
@@ -105,6 +105,6 @@ func TestRemoveInvalidContainer(t *testing.T) {
|
| 105 | 105 |
apiClient := testEnv.APIClient() |
| 106 | 106 |
|
| 107 | 107 |
err := apiClient.ContainerRemove(ctx, "unknown", containertypes.RemoveOptions{})
|
| 108 |
- assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) |
|
| 108 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
|
| 109 | 109 |
assert.Check(t, is.ErrorContains(err, "No such container")) |
| 110 | 110 |
} |
| ... | ... |
@@ -6,9 +6,9 @@ import ( |
| 6 | 6 |
"net/url" |
| 7 | 7 |
"testing" |
| 8 | 8 |
|
| 9 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 9 | 10 |
"github.com/docker/docker/api/types" |
| 10 | 11 |
containertypes "github.com/docker/docker/api/types/container" |
| 11 |
- "github.com/docker/docker/errdefs" |
|
| 12 | 12 |
"github.com/docker/docker/integration/internal/container" |
| 13 | 13 |
req "github.com/docker/docker/testutil/request" |
| 14 | 14 |
"gotest.tools/v3/assert" |
| ... | ... |
@@ -133,7 +133,7 @@ func TestResize(t *testing.T) {
|
| 133 | 133 |
Height: 40, |
| 134 | 134 |
Width: 40, |
| 135 | 135 |
}) |
| 136 |
- assert.Check(t, is.ErrorType(err, errdefs.IsConflict)) |
|
| 136 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict)) |
|
| 137 | 137 |
assert.Check(t, is.ErrorContains(err, "is not running")) |
| 138 | 138 |
}) |
| 139 | 139 |
} |
| ... | ... |
@@ -8,9 +8,9 @@ import ( |
| 8 | 8 |
"testing" |
| 9 | 9 |
"time" |
| 10 | 10 |
|
| 11 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 11 | 12 |
containertypes "github.com/docker/docker/api/types/container" |
| 12 | 13 |
"github.com/docker/docker/client" |
| 13 |
- "github.com/docker/docker/errdefs" |
|
| 14 | 14 |
"github.com/docker/docker/integration/internal/container" |
| 15 | 15 |
"github.com/docker/docker/pkg/stdcopy" |
| 16 | 16 |
"gotest.tools/v3/assert" |
| ... | ... |
@@ -50,7 +50,7 @@ func TestStopContainerWithTimeoutCancel(t *testing.T) {
|
| 50 | 50 |
|
| 51 | 51 |
select {
|
| 52 | 52 |
case stoppedErr := <-stoppedCh: |
| 53 |
- assert.Check(t, is.ErrorType(stoppedErr, errdefs.IsCancelled)) |
|
| 53 |
+ assert.Check(t, is.ErrorType(stoppedErr, cerrdefs.IsCanceled)) |
|
| 54 | 54 |
case <-time.After(5 * time.Second): |
| 55 | 55 |
t.Fatal("timeout waiting for stop request to be cancelled")
|
| 56 | 56 |
} |
| ... | ... |
@@ -4,8 +4,8 @@ import ( |
| 4 | 4 |
"testing" |
| 5 | 5 |
"time" |
| 6 | 6 |
|
| 7 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 7 | 8 |
containertypes "github.com/docker/docker/api/types/container" |
| 8 |
- "github.com/docker/docker/errdefs" |
|
| 9 | 9 |
"github.com/docker/docker/integration/internal/container" |
| 10 | 10 |
"gotest.tools/v3/assert" |
| 11 | 11 |
is "gotest.tools/v3/assert/cmp" |
| ... | ... |
@@ -56,5 +56,5 @@ func TestUpdateRestartWithAutoRemove(t *testing.T) {
|
| 56 | 56 |
}, |
| 57 | 57 |
}) |
| 58 | 58 |
assert.Check(t, is.ErrorContains(err, "Restart policy cannot be updated because AutoRemove is enabled for the container")) |
| 59 |
- assert.Check(t, is.ErrorType(err, errdefs.IsConflict)) |
|
| 59 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict)) |
|
| 60 | 60 |
} |
| ... | ... |
@@ -14,12 +14,12 @@ import ( |
| 14 | 14 |
"syscall" |
| 15 | 15 |
"testing" |
| 16 | 16 |
|
| 17 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 17 | 18 |
containertypes "github.com/docker/docker/api/types/container" |
| 18 | 19 |
"github.com/docker/docker/api/types/image" |
| 19 | 20 |
"github.com/docker/docker/api/types/mount" |
| 20 | 21 |
"github.com/docker/docker/api/types/volume" |
| 21 | 22 |
"github.com/docker/docker/daemon/config" |
| 22 |
- "github.com/docker/docker/errdefs" |
|
| 23 | 23 |
"github.com/docker/docker/integration/internal/container" |
| 24 | 24 |
"github.com/docker/docker/integration/internal/process" |
| 25 | 25 |
"github.com/docker/docker/pkg/stdcopy" |
| ... | ... |
@@ -609,7 +609,7 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
|
| 609 | 609 |
poll.WaitOn(t, func(t poll.LogT) poll.Result {
|
| 610 | 610 |
stat, err := c.ContainerStatPath(ctx, cID, "/foo/test.txt") |
| 611 | 611 |
if err != nil {
|
| 612 |
- if errdefs.IsNotFound(err) {
|
|
| 612 |
+ if cerrdefs.IsNotFound(err) {
|
|
| 613 | 613 |
return poll.Continue("file doesn't yet exist")
|
| 614 | 614 |
} |
| 615 | 615 |
return poll.Error(err) |
| ... | ... |
@@ -682,7 +682,7 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
|
| 682 | 682 |
waitFn := func(t poll.LogT) poll.Result {
|
| 683 | 683 |
_, err := c.ContainerStatPath(ctx, cID, "/image/hello") |
| 684 | 684 |
if err != nil {
|
| 685 |
- if errdefs.IsNotFound(err) {
|
|
| 685 |
+ if cerrdefs.IsNotFound(err) {
|
|
| 686 | 686 |
return poll.Continue("file doesn't yet exist")
|
| 687 | 687 |
} |
| 688 | 688 |
return poll.Error(err) |
| ... | ... |
@@ -9,8 +9,8 @@ import ( |
| 9 | 9 |
"strings" |
| 10 | 10 |
"testing" |
| 11 | 11 |
|
| 12 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 12 | 13 |
imagetypes "github.com/docker/docker/api/types/image" |
| 13 |
- "github.com/docker/docker/errdefs" |
|
| 14 | 14 |
"github.com/docker/docker/image" |
| 15 | 15 |
"github.com/docker/docker/testutil" |
| 16 | 16 |
"github.com/docker/docker/testutil/daemon" |
| ... | ... |
@@ -178,7 +178,7 @@ func TestImportWithCustomPlatformReject(t *testing.T) {
|
| 178 | 178 |
reference, |
| 179 | 179 |
imagetypes.ImportOptions{Platform: tc.platform})
|
| 180 | 180 |
|
| 181 |
- assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter)) |
|
| 181 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument)) |
|
| 182 | 182 |
assert.Check(t, is.ErrorContains(err, tc.expectedErr)) |
| 183 | 183 |
}) |
| 184 | 184 |
} |
| ... | ... |
@@ -15,9 +15,9 @@ import ( |
| 15 | 15 |
"github.com/containerd/containerd/v2/core/content" |
| 16 | 16 |
c8dimages "github.com/containerd/containerd/v2/core/images" |
| 17 | 17 |
"github.com/containerd/containerd/v2/plugins/content/local" |
| 18 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 18 | 19 |
"github.com/containerd/platforms" |
| 19 | 20 |
"github.com/docker/docker/api/types/image" |
| 20 |
- "github.com/docker/docker/errdefs" |
|
| 21 | 21 |
"github.com/docker/docker/testutil/daemon" |
| 22 | 22 |
"github.com/docker/docker/testutil/registry" |
| 23 | 23 |
"github.com/opencontainers/go-digest" |
| ... | ... |
@@ -36,7 +36,7 @@ func TestImagePullPlatformInvalid(t *testing.T) {
|
| 36 | 36 |
_, err := client.ImagePull(ctx, "docker.io/library/hello-world:latest", image.PullOptions{Platform: "foobar"})
|
| 37 | 37 |
assert.Assert(t, err != nil) |
| 38 | 38 |
assert.Check(t, is.ErrorContains(err, "unknown operating system or architecture")) |
| 39 |
- assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter)) |
|
| 39 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument)) |
|
| 40 | 40 |
} |
| 41 | 41 |
|
| 42 | 42 |
func createTestImage(ctx context.Context, t testing.TB, store content.Store) ocispec.Descriptor {
|
| ... | ... |
@@ -157,8 +157,8 @@ func TestImagePullStoredDigestForOtherRepo(t *testing.T) {
|
| 157 | 157 |
assert.Check(t, rdr.Close()) |
| 158 | 158 |
} |
| 159 | 159 |
assert.Assert(t, err != nil, "Expected error, got none: %v", err) |
| 160 |
- assert.Assert(t, errdefs.IsNotFound(err), err) |
|
| 161 |
- assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) |
|
| 160 |
+ assert.Assert(t, cerrdefs.IsNotFound(err), err) |
|
| 161 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
|
| 162 | 162 |
} |
| 163 | 163 |
|
| 164 | 164 |
// TestImagePullNonExisting pulls non-existing images from the central registry, with different |
| ... | ... |
@@ -188,7 +188,7 @@ func TestImagePullNonExisting(t *testing.T) {
|
| 188 | 188 |
|
| 189 | 189 |
expectedMsg := fmt.Sprintf("pull access denied for %s, repository does not exist or may require 'docker login'", "asdfasdf")
|
| 190 | 190 |
assert.Check(t, is.ErrorContains(err, expectedMsg)) |
| 191 |
- assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) |
|
| 191 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
|
| 192 | 192 |
if all {
|
| 193 | 193 |
// pull -a on a nonexistent registry should fall back as well |
| 194 | 194 |
assert.Check(t, !strings.Contains(err.Error(), "unauthorized"), `message should not contain "unauthorized"`) |
| ... | ... |
@@ -4,11 +4,11 @@ import ( |
| 4 | 4 |
"strings" |
| 5 | 5 |
"testing" |
| 6 | 6 |
|
| 7 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 7 | 8 |
"github.com/containerd/platforms" |
| 8 | 9 |
|
| 9 | 10 |
containertypes "github.com/docker/docker/api/types/container" |
| 10 | 11 |
"github.com/docker/docker/api/types/image" |
| 11 |
- "github.com/docker/docker/errdefs" |
|
| 12 | 12 |
"github.com/docker/docker/integration/internal/container" |
| 13 | 13 |
"github.com/docker/docker/internal/testutils/specialimage" |
| 14 | 14 |
ocispec "github.com/opencontainers/image-spec/specs-go/v1" |
| ... | ... |
@@ -92,7 +92,7 @@ func TestRemoveByDigest(t *testing.T) {
|
| 92 | 92 |
assert.NilError(t, err, "busybox image got deleted") |
| 93 | 93 |
|
| 94 | 94 |
inspect, err = client.ImageInspect(ctx, "test-remove-by-digest") |
| 95 |
- assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) |
|
| 95 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
|
| 96 | 96 |
assert.Check(t, is.DeepEqual(inspect, image.InspectResponse{}))
|
| 97 | 97 |
} |
| 98 | 98 |
|
| ... | ... |
@@ -13,11 +13,11 @@ import ( |
| 13 | 13 |
"testing" |
| 14 | 14 |
"time" |
| 15 | 15 |
|
| 16 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 16 | 17 |
"github.com/cpuguy83/tar2go" |
| 17 | 18 |
containertypes "github.com/docker/docker/api/types/container" |
| 18 | 19 |
"github.com/docker/docker/api/types/versions" |
| 19 | 20 |
"github.com/docker/docker/client" |
| 20 |
- "github.com/docker/docker/errdefs" |
|
| 21 | 21 |
"github.com/docker/docker/integration/internal/build" |
| 22 | 22 |
"github.com/docker/docker/integration/internal/container" |
| 23 | 23 |
"github.com/docker/docker/internal/testutils" |
| ... | ... |
@@ -227,7 +227,7 @@ func TestSavePlatform(t *testing.T) {
|
| 227 | 227 |
ocispec.Platform{Architecture: "amd64", OS: "linux"},
|
| 228 | 228 |
ocispec.Platform{Architecture: "arm64", OS: "linux", Variant: "v8"},
|
| 229 | 229 |
)) |
| 230 |
- assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter)) |
|
| 230 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument)) |
|
| 231 | 231 |
assert.Check(t, is.Error(err, "Error response from daemon: multiple platform parameters not supported")) |
| 232 | 232 |
} |
| 233 | 233 |
|
| ... | ... |
@@ -4,9 +4,9 @@ import ( |
| 4 | 4 |
"context" |
| 5 | 5 |
"strings" |
| 6 | 6 |
|
| 7 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 7 | 8 |
"github.com/docker/docker/api/types/container" |
| 8 | 9 |
"github.com/docker/docker/client" |
| 9 |
- "github.com/docker/docker/errdefs" |
|
| 10 | 10 |
"github.com/pkg/errors" |
| 11 | 11 |
"gotest.tools/v3/poll" |
| 12 | 12 |
) |
| ... | ... |
@@ -74,7 +74,7 @@ func IsRemoved(ctx context.Context, apiClient client.APIClient, containerID stri |
| 74 | 74 |
return func(log poll.LogT) poll.Result {
|
| 75 | 75 |
inspect, err := apiClient.ContainerInspect(ctx, containerID) |
| 76 | 76 |
if err != nil {
|
| 77 |
- if errdefs.IsNotFound(err) {
|
|
| 77 |
+ if cerrdefs.IsNotFound(err) {
|
|
| 78 | 78 |
return poll.Success() |
| 79 | 79 |
} |
| 80 | 80 |
return poll.Error(err) |
| ... | ... |
@@ -8,11 +8,11 @@ import ( |
| 8 | 8 |
"testing" |
| 9 | 9 |
"time" |
| 10 | 10 |
|
| 11 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 11 | 12 |
"github.com/docker/docker/api/types/container" |
| 12 | 13 |
"github.com/docker/docker/api/types/filters" |
| 13 | 14 |
swarmtypes "github.com/docker/docker/api/types/swarm" |
| 14 | 15 |
"github.com/docker/docker/client" |
| 15 |
- "github.com/docker/docker/errdefs" |
|
| 16 | 16 |
"github.com/docker/docker/integration/internal/swarm" |
| 17 | 17 |
"github.com/docker/docker/pkg/stdcopy" |
| 18 | 18 |
"github.com/docker/docker/testutil" |
| ... | ... |
@@ -142,18 +142,18 @@ func TestSecretsCreateAndDelete(t *testing.T) {
|
| 142 | 142 |
}, |
| 143 | 143 |
Data: []byte("TESTINGDATA"),
|
| 144 | 144 |
}) |
| 145 |
- assert.Check(t, errdefs.IsConflict(err)) |
|
| 145 |
+ assert.Check(t, cerrdefs.IsConflict(err)) |
|
| 146 | 146 |
assert.Check(t, is.ErrorContains(err, testName)) |
| 147 | 147 |
|
| 148 | 148 |
err = c.SecretRemove(ctx, secretID) |
| 149 | 149 |
assert.NilError(t, err) |
| 150 | 150 |
|
| 151 | 151 |
_, _, err = c.SecretInspectWithRaw(ctx, secretID) |
| 152 |
- assert.Check(t, errdefs.IsNotFound(err)) |
|
| 152 |
+ assert.Check(t, cerrdefs.IsNotFound(err)) |
|
| 153 | 153 |
assert.Check(t, is.ErrorContains(err, secretID)) |
| 154 | 154 |
|
| 155 | 155 |
err = c.SecretRemove(ctx, "non-existing") |
| 156 |
- assert.Check(t, errdefs.IsNotFound(err)) |
|
| 156 |
+ assert.Check(t, cerrdefs.IsNotFound(err)) |
|
| 157 | 157 |
assert.Check(t, is.ErrorContains(err, "non-existing")) |
| 158 | 158 |
|
| 159 | 159 |
testName = "test_secret_with_labels_" + t.Name() |
| ... | ... |
@@ -217,7 +217,7 @@ func TestSecretsUpdate(t *testing.T) {
|
| 217 | 217 |
// this test will produce an error in func UpdateSecret |
| 218 | 218 |
insp.Spec.Data = []byte("TESTINGDATA2")
|
| 219 | 219 |
err = c.SecretUpdate(ctx, secretID, insp.Version, insp.Spec) |
| 220 |
- assert.Check(t, errdefs.IsInvalidParameter(err)) |
|
| 220 |
+ assert.Check(t, cerrdefs.IsInvalidArgument(err)) |
|
| 221 | 221 |
assert.Check(t, is.ErrorContains(err, "only updates to Labels are allowed")) |
| 222 | 222 |
} |
| 223 | 223 |
|
| ... | ... |
@@ -7,11 +7,11 @@ import ( |
| 7 | 7 |
"testing" |
| 8 | 8 |
"time" |
| 9 | 9 |
|
| 10 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 10 | 11 |
"github.com/docker/docker/api/types/container" |
| 11 | 12 |
"github.com/docker/docker/api/types/filters" |
| 12 | 13 |
swarmtypes "github.com/docker/docker/api/types/swarm" |
| 13 | 14 |
"github.com/docker/docker/client" |
| 14 |
- "github.com/docker/docker/errdefs" |
|
| 15 | 15 |
"github.com/docker/docker/integration/internal/network" |
| 16 | 16 |
"github.com/docker/docker/integration/internal/swarm" |
| 17 | 17 |
"github.com/docker/docker/testutil" |
| ... | ... |
@@ -165,7 +165,7 @@ func TestCreateServiceConflict(t *testing.T) {
|
| 165 | 165 |
|
| 166 | 166 |
spec := swarm.CreateServiceSpec(t, serviceSpec...) |
| 167 | 167 |
_, err := c.ServiceCreate(ctx, spec, swarmtypes.ServiceCreateOptions{})
|
| 168 |
- assert.Check(t, errdefs.IsConflict(err)) |
|
| 168 |
+ assert.Check(t, cerrdefs.IsConflict(err)) |
|
| 169 | 169 |
assert.ErrorContains(t, err, "service "+serviceName+" already exists") |
| 170 | 170 |
} |
| 171 | 171 |
|
| ... | ... |
@@ -8,11 +8,11 @@ import ( |
| 8 | 8 |
"testing" |
| 9 | 9 |
"time" |
| 10 | 10 |
|
| 11 |
+ cerrdefs "github.com/containerd/errdefs" |
|
| 11 | 12 |
containertypes "github.com/docker/docker/api/types/container" |
| 12 | 13 |
"github.com/docker/docker/api/types/filters" |
| 13 | 14 |
"github.com/docker/docker/api/types/volume" |
| 14 | 15 |
clientpkg "github.com/docker/docker/client" |
| 15 |
- "github.com/docker/docker/errdefs" |
|
| 16 | 16 |
"github.com/docker/docker/integration/internal/build" |
| 17 | 17 |
"github.com/docker/docker/integration/internal/container" |
| 18 | 18 |
"github.com/docker/docker/testutil" |
| ... | ... |
@@ -79,7 +79,7 @@ func TestVolumesRemove(t *testing.T) {
|
| 79 | 79 |
|
| 80 | 80 |
t.Run("volume in use", func(t *testing.T) {
|
| 81 | 81 |
err = client.VolumeRemove(ctx, vname, false) |
| 82 |
- assert.Check(t, is.ErrorType(err, errdefs.IsConflict)) |
|
| 82 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict)) |
|
| 83 | 83 |
assert.Check(t, is.ErrorContains(err, "volume is in use")) |
| 84 | 84 |
}) |
| 85 | 85 |
|
| ... | ... |
@@ -95,7 +95,7 @@ func TestVolumesRemove(t *testing.T) {
|
| 95 | 95 |
|
| 96 | 96 |
t.Run("non-existing volume", func(t *testing.T) {
|
| 97 | 97 |
err = client.VolumeRemove(ctx, "no_such_volume", false) |
| 98 |
- assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) |
|
| 98 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
|
| 99 | 99 |
}) |
| 100 | 100 |
|
| 101 | 101 |
t.Run("non-existing volume force", func(t *testing.T) {
|
| ... | ... |
@@ -131,7 +131,7 @@ func TestVolumesRemoveSwarmEnabled(t *testing.T) {
|
| 131 | 131 |
|
| 132 | 132 |
t.Run("volume in use", func(t *testing.T) {
|
| 133 | 133 |
err = client.VolumeRemove(ctx, vname, false) |
| 134 |
- assert.Check(t, is.ErrorType(err, errdefs.IsConflict)) |
|
| 134 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict)) |
|
| 135 | 135 |
assert.Check(t, is.ErrorContains(err, "volume is in use")) |
| 136 | 136 |
}) |
| 137 | 137 |
|
| ... | ... |
@@ -147,7 +147,7 @@ func TestVolumesRemoveSwarmEnabled(t *testing.T) {
|
| 147 | 147 |
|
| 148 | 148 |
t.Run("non-existing volume", func(t *testing.T) {
|
| 149 | 149 |
err = client.VolumeRemove(ctx, "no_such_volume", false) |
| 150 |
- assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) |
|
| 150 |
+ assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
|
| 151 | 151 |
}) |
| 152 | 152 |
|
| 153 | 153 |
t.Run("non-existing volume force", func(t *testing.T) {
|