integration: replace uses of errdefs package

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL
2025-05-28 05:39:50 +00:00
parent a1a789dbd0
commit 14852fcd82
20 changed files with 68 additions and 68 deletions

View File

@@ -13,12 +13,12 @@ import (
"testing"
"time"
cerrdefs "github.com/containerd/errdefs"
"github.com/docker/docker/api/types/build"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/events"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/pkg/jsonmessage"
"github.com/docker/docker/testutil"
"github.com/docker/docker/testutil/fakecontext"
@@ -690,7 +690,7 @@ func TestBuildPlatformInvalid(t *testing.T) {
})
assert.Check(t, is.ErrorContains(err, "unknown operating system or architecture"))
assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
}
// TestBuildWorkdirNoCacheMiss is a regression test for https://github.com/moby/moby/issues/47627

View File

@@ -8,11 +8,11 @@ import (
"testing"
"time"
cerrdefs "github.com/containerd/errdefs"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
swarmtypes "github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/client"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/integration/internal/swarm"
"github.com/docker/docker/pkg/stdcopy"
"github.com/docker/docker/testutil"
@@ -147,11 +147,11 @@ func TestConfigsCreateAndDelete(t *testing.T) {
assert.NilError(t, err)
_, _, err = c.ConfigInspectWithRaw(ctx, configID)
assert.Check(t, errdefs.IsNotFound(err))
assert.Check(t, cerrdefs.IsNotFound(err))
assert.Check(t, is.ErrorContains(err, configID))
err = c.ConfigRemove(ctx, "non-existing")
assert.Check(t, errdefs.IsNotFound(err))
assert.Check(t, cerrdefs.IsNotFound(err))
assert.Check(t, is.ErrorContains(err, "non-existing"))
testName = "test_secret_with_labels_" + t.Name()
@@ -216,7 +216,7 @@ func TestConfigsUpdate(t *testing.T) {
// this test will produce an error in func UpdateConfig
insp.Spec.Data = []byte("TESTINGDATA2")
err = c.ConfigUpdate(ctx, configID, insp.Version, insp.Spec)
assert.Check(t, errdefs.IsInvalidParameter(err))
assert.Check(t, cerrdefs.IsInvalidArgument(err))
assert.Check(t, is.ErrorContains(err, "only updates to Labels are allowed"))
}

View File

@@ -11,9 +11,9 @@ import (
"strings"
"testing"
cerrdefs "github.com/containerd/errdefs"
"github.com/docker/docker/api/types/build"
containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/integration/internal/container"
"github.com/docker/docker/pkg/jsonmessage"
"github.com/docker/docker/testutil/fakecontext"
@@ -30,7 +30,7 @@ func TestCopyFromContainerPathDoesNotExist(t *testing.T) {
cid := container.Create(ctx, t, apiClient)
_, _, err := apiClient.CopyFromContainer(ctx, cid, "/dne")
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
assert.Check(t, is.ErrorContains(err, "Could not find the file /dne in container "+cid))
}
@@ -58,7 +58,7 @@ func TestCopyToContainerPathDoesNotExist(t *testing.T) {
cid := container.Create(ctx, t, apiClient)
err := apiClient.CopyToContainer(ctx, cid, "/dne", nil, containertypes.CopyToContainerOptions{})
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
assert.Check(t, is.ErrorContains(err, "Could not find the file /dne in container "+cid))
}

View File

@@ -11,11 +11,11 @@ import (
"time"
containerd "github.com/containerd/containerd/v2/client"
cerrdefs "github.com/containerd/errdefs"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/client"
"github.com/docker/docker/errdefs"
testContainer "github.com/docker/docker/integration/internal/container"
net "github.com/docker/docker/integration/internal/network"
"github.com/docker/docker/oci"
@@ -66,7 +66,7 @@ func TestCreateFailsWhenIdentifierDoesNotExist(t *testing.T) {
"",
)
assert.Check(t, is.ErrorContains(err, tc.expectedError))
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
})
}
}
@@ -104,13 +104,13 @@ func TestCreateByImageID(t *testing.T) {
{
doc: "image with ID and algorithm as tag",
image: "busybox:" + imgIDWithAlgorithm,
expectedErrType: errdefs.IsInvalidParameter,
expectedErrType: cerrdefs.IsInvalidArgument,
expectedErr: "Error response from daemon: invalid reference format",
},
{
doc: "image with ID as tag",
image: "busybox:" + imgID,
expectedErrType: errdefs.IsNotFound,
expectedErrType: cerrdefs.IsNotFound,
expectedErr: "Error response from daemon: No such image: busybox:" + imgID,
},
}
@@ -160,7 +160,7 @@ func TestCreateLinkToNonExistingContainer(t *testing.T) {
"",
)
assert.Check(t, is.ErrorContains(err, "could not get container for no-such-container"))
assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
}
func TestCreateWithInvalidEnv(t *testing.T) {
@@ -200,7 +200,7 @@ func TestCreateWithInvalidEnv(t *testing.T) {
"",
)
assert.Check(t, is.ErrorContains(err, tc.expectedError))
assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
})
}
}
@@ -247,7 +247,7 @@ func TestCreateTmpfsMountsTarget(t *testing.T) {
"",
)
assert.Check(t, is.ErrorContains(err, tc.expectedError))
assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
}
}
@@ -502,7 +502,7 @@ func TestCreateWithInvalidHealthcheckParams(t *testing.T) {
resp, err := apiClient.ContainerCreate(ctx, &cfg, &container.HostConfig{}, nil, nil, "")
assert.Check(t, is.Equal(len(resp.Warnings), 0))
assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
assert.ErrorContains(t, err, tc.expectedErr)
})
}
@@ -572,7 +572,7 @@ func TestCreateDifferentPlatform(t *testing.T) {
Variant: img.Variant,
}
_, err := apiClient.ContainerCreate(ctx, &container.Config{Image: "busybox:latest"}, &container.HostConfig{}, nil, &p, "")
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
})
t.Run("different cpu arch", func(t *testing.T) {
ctx := testutil.StartSpan(ctx, t)
@@ -582,7 +582,7 @@ func TestCreateDifferentPlatform(t *testing.T) {
Variant: img.Variant,
}
_, err := apiClient.ContainerCreate(ctx, &container.Config{Image: "busybox:latest"}, &container.HostConfig{}, nil, &p, "")
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
})
}
@@ -598,7 +598,7 @@ func TestCreateVolumesFromNonExistingContainer(t *testing.T) {
nil,
"",
)
assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
}
// 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) {
}
resp, err := apiClient.ContainerCreate(ctx, &cfg, &tc.hc, nil, nil, "")
assert.Check(t, is.Equal(len(resp.Warnings), 0))
assert.Check(t, errdefs.IsInvalidParameter(err), "got: %T", err)
assert.Check(t, cerrdefs.IsInvalidArgument(err), "got: %T", err)
assert.Error(t, err, tc.expectedErr)
})
}

View File

@@ -10,9 +10,9 @@ import (
"testing"
"time"
cerrdefs "github.com/containerd/errdefs"
"github.com/docker/docker/api/types"
containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/integration/internal/build"
"github.com/docker/docker/integration/internal/container"
"github.com/docker/docker/testutil/fakecontext"
@@ -244,7 +244,7 @@ func TestExecResize(t *testing.T) {
Height: 40,
Width: 40,
})
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
assert.Check(t, is.ErrorContains(err, "No such exec instance: no-such-exec-id"))
})
@@ -272,7 +272,7 @@ func TestExecResize(t *testing.T) {
Height: 40,
Width: 40,
})
assert.Check(t, is.ErrorType(err, errdefs.IsConflict))
assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict))
assert.Check(t, is.ErrorContains(err, "is not running"))
})
}
@@ -394,7 +394,7 @@ func TestExecUser(t *testing.T) {
result, err := container.Exec(ctx, apiClient, cID, []string{"id"}, withUser(tc.user))
if tc.expectedErr != "" {
assert.Check(t, is.Error(err, tc.expectedErr))
assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
assert.Check(t, is.Equal(result.Stdout(), "<nil>"))
assert.Check(t, is.Equal(result.Stderr(), "<nil>"))
} else {

View File

@@ -7,13 +7,13 @@ import (
"syscall"
"testing"
cerrdefs "github.com/containerd/errdefs"
"github.com/docker/docker/api"
containertypes "github.com/docker/docker/api/types/container"
mounttypes "github.com/docker/docker/api/types/mount"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/client"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/integration/internal/container"
"github.com/docker/docker/pkg/parsers/kernel"
"github.com/docker/docker/testutil"
@@ -435,7 +435,7 @@ func TestContainerVolumeAnonymous(t *testing.T) {
// when used, which we use as indicator that the driver was passed
// through. We should have a cleaner way for this, but that would
// require a custom volume plugin to be installed.
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
assert.Check(t, is.ErrorContains(err, fmt.Sprintf(`plugin %q not found`, testNonExistingPlugin)))
})
}

View File

@@ -4,8 +4,8 @@ import (
"os"
"testing"
cerrdefs "github.com/containerd/errdefs"
containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/integration/internal/container"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
@@ -39,7 +39,7 @@ func TestPIDModeContainer(t *testing.T) {
t.Run("non-existing container", func(t *testing.T) {
_, err := container.CreateFromConfig(ctx, apiClient, container.NewTestConfig(container.WithPIDMode("container:nosuchcontainer")))
assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
assert.Check(t, is.ErrorContains(err, "No such container: nosuchcontainer"))
})
@@ -51,7 +51,7 @@ func TestPIDModeContainer(t *testing.T) {
assert.NilError(t, err, "should not produce an error when creating, only when starting")
err = apiClient.ContainerStart(ctx, ctr.ID, containertypes.StartOptions{})
assert.Check(t, is.ErrorType(err, errdefs.IsSystem), "should produce a System error when starting an existing container from an invalid state")
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal), "should produce a System error when starting an existing container from an invalid state")
assert.Check(t, is.ErrorContains(err, "failed to join PID namespace"))
assert.Check(t, is.ErrorContains(err, cPIDContainerID+" is not running"))
})

View File

@@ -4,10 +4,10 @@ import (
"os"
"testing"
cerrdefs "github.com/containerd/errdefs"
containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/volume"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/integration/internal/container"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
@@ -46,7 +46,7 @@ func TestRemoveContainerWithRemovedVolume(t *testing.T) {
assert.NilError(t, err)
_, _, err = apiClient.ContainerInspectWithRaw(ctx, cID, true)
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
assert.Check(t, is.ErrorContains(err, "No such container"))
}
@@ -84,7 +84,7 @@ func TestRemoveContainerRunning(t *testing.T) {
cID := container.Run(ctx, t, apiClient)
err := apiClient.ContainerRemove(ctx, cID, containertypes.RemoveOptions{})
assert.Check(t, is.ErrorType(err, errdefs.IsConflict))
assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict))
assert.Check(t, is.ErrorContains(err, "container is running"))
}
@@ -105,6 +105,6 @@ func TestRemoveInvalidContainer(t *testing.T) {
apiClient := testEnv.APIClient()
err := apiClient.ContainerRemove(ctx, "unknown", containertypes.RemoveOptions{})
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
assert.Check(t, is.ErrorContains(err, "No such container"))
}

View File

@@ -6,9 +6,9 @@ import (
"net/url"
"testing"
cerrdefs "github.com/containerd/errdefs"
"github.com/docker/docker/api/types"
containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/integration/internal/container"
req "github.com/docker/docker/testutil/request"
"gotest.tools/v3/assert"
@@ -133,7 +133,7 @@ func TestResize(t *testing.T) {
Height: 40,
Width: 40,
})
assert.Check(t, is.ErrorType(err, errdefs.IsConflict))
assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict))
assert.Check(t, is.ErrorContains(err, "is not running"))
})
}

View File

@@ -8,9 +8,9 @@ import (
"testing"
"time"
cerrdefs "github.com/containerd/errdefs"
containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/client"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/integration/internal/container"
"github.com/docker/docker/pkg/stdcopy"
"gotest.tools/v3/assert"
@@ -50,7 +50,7 @@ func TestStopContainerWithTimeoutCancel(t *testing.T) {
select {
case stoppedErr := <-stoppedCh:
assert.Check(t, is.ErrorType(stoppedErr, errdefs.IsCancelled))
assert.Check(t, is.ErrorType(stoppedErr, cerrdefs.IsCanceled))
case <-time.After(5 * time.Second):
t.Fatal("timeout waiting for stop request to be cancelled")
}

View File

@@ -4,8 +4,8 @@ import (
"testing"
"time"
cerrdefs "github.com/containerd/errdefs"
containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/integration/internal/container"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
@@ -56,5 +56,5 @@ func TestUpdateRestartWithAutoRemove(t *testing.T) {
},
})
assert.Check(t, is.ErrorContains(err, "Restart policy cannot be updated because AutoRemove is enabled for the container"))
assert.Check(t, is.ErrorType(err, errdefs.IsConflict))
assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict))
}

View File

@@ -14,12 +14,12 @@ import (
"syscall"
"testing"
cerrdefs "github.com/containerd/errdefs"
containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/mount"
"github.com/docker/docker/api/types/volume"
"github.com/docker/docker/daemon/config"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/integration/internal/container"
"github.com/docker/docker/integration/internal/process"
"github.com/docker/docker/pkg/stdcopy"
@@ -609,7 +609,7 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
poll.WaitOn(t, func(t poll.LogT) poll.Result {
stat, err := c.ContainerStatPath(ctx, cID, "/foo/test.txt")
if err != nil {
if errdefs.IsNotFound(err) {
if cerrdefs.IsNotFound(err) {
return poll.Continue("file doesn't yet exist")
}
return poll.Error(err)
@@ -682,7 +682,7 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
waitFn := func(t poll.LogT) poll.Result {
_, err := c.ContainerStatPath(ctx, cID, "/image/hello")
if err != nil {
if errdefs.IsNotFound(err) {
if cerrdefs.IsNotFound(err) {
return poll.Continue("file doesn't yet exist")
}
return poll.Error(err)

View File

@@ -9,8 +9,8 @@ import (
"strings"
"testing"
cerrdefs "github.com/containerd/errdefs"
imagetypes "github.com/docker/docker/api/types/image"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/image"
"github.com/docker/docker/testutil"
"github.com/docker/docker/testutil/daemon"
@@ -178,7 +178,7 @@ func TestImportWithCustomPlatformReject(t *testing.T) {
reference,
imagetypes.ImportOptions{Platform: tc.platform})
assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
assert.Check(t, is.ErrorContains(err, tc.expectedErr))
})
}

View File

@@ -15,9 +15,9 @@ import (
"github.com/containerd/containerd/v2/core/content"
c8dimages "github.com/containerd/containerd/v2/core/images"
"github.com/containerd/containerd/v2/plugins/content/local"
cerrdefs "github.com/containerd/errdefs"
"github.com/containerd/platforms"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/testutil/daemon"
"github.com/docker/docker/testutil/registry"
"github.com/opencontainers/go-digest"
@@ -36,7 +36,7 @@ func TestImagePullPlatformInvalid(t *testing.T) {
_, err := client.ImagePull(ctx, "docker.io/library/hello-world:latest", image.PullOptions{Platform: "foobar"})
assert.Assert(t, err != nil)
assert.Check(t, is.ErrorContains(err, "unknown operating system or architecture"))
assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
}
func createTestImage(ctx context.Context, t testing.TB, store content.Store) ocispec.Descriptor {
@@ -157,8 +157,8 @@ func TestImagePullStoredDigestForOtherRepo(t *testing.T) {
assert.Check(t, rdr.Close())
}
assert.Assert(t, err != nil, "Expected error, got none: %v", err)
assert.Assert(t, errdefs.IsNotFound(err), err)
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
assert.Assert(t, cerrdefs.IsNotFound(err), err)
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
}
// TestImagePullNonExisting pulls non-existing images from the central registry, with different
@@ -188,7 +188,7 @@ func TestImagePullNonExisting(t *testing.T) {
expectedMsg := fmt.Sprintf("pull access denied for %s, repository does not exist or may require 'docker login'", "asdfasdf")
assert.Check(t, is.ErrorContains(err, expectedMsg))
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
if all {
// pull -a on a nonexistent registry should fall back as well
assert.Check(t, !strings.Contains(err.Error(), "unauthorized"), `message should not contain "unauthorized"`)

View File

@@ -4,11 +4,11 @@ import (
"strings"
"testing"
cerrdefs "github.com/containerd/errdefs"
"github.com/containerd/platforms"
containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/integration/internal/container"
"github.com/docker/docker/internal/testutils/specialimage"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
@@ -92,7 +92,7 @@ func TestRemoveByDigest(t *testing.T) {
assert.NilError(t, err, "busybox image got deleted")
inspect, err = client.ImageInspect(ctx, "test-remove-by-digest")
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
assert.Check(t, is.DeepEqual(inspect, image.InspectResponse{}))
}

View File

@@ -13,11 +13,11 @@ import (
"testing"
"time"
cerrdefs "github.com/containerd/errdefs"
"github.com/cpuguy83/tar2go"
containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/client"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/integration/internal/build"
"github.com/docker/docker/integration/internal/container"
"github.com/docker/docker/internal/testutils"
@@ -227,7 +227,7 @@ func TestSavePlatform(t *testing.T) {
ocispec.Platform{Architecture: "amd64", OS: "linux"},
ocispec.Platform{Architecture: "arm64", OS: "linux", Variant: "v8"},
))
assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
assert.Check(t, is.Error(err, "Error response from daemon: multiple platform parameters not supported"))
}

View File

@@ -4,9 +4,9 @@ import (
"context"
"strings"
cerrdefs "github.com/containerd/errdefs"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/client"
"github.com/docker/docker/errdefs"
"github.com/pkg/errors"
"gotest.tools/v3/poll"
)
@@ -74,7 +74,7 @@ func IsRemoved(ctx context.Context, apiClient client.APIClient, containerID stri
return func(log poll.LogT) poll.Result {
inspect, err := apiClient.ContainerInspect(ctx, containerID)
if err != nil {
if errdefs.IsNotFound(err) {
if cerrdefs.IsNotFound(err) {
return poll.Success()
}
return poll.Error(err)

View File

@@ -8,11 +8,11 @@ import (
"testing"
"time"
cerrdefs "github.com/containerd/errdefs"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
swarmtypes "github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/client"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/integration/internal/swarm"
"github.com/docker/docker/pkg/stdcopy"
"github.com/docker/docker/testutil"
@@ -142,18 +142,18 @@ func TestSecretsCreateAndDelete(t *testing.T) {
},
Data: []byte("TESTINGDATA"),
})
assert.Check(t, errdefs.IsConflict(err))
assert.Check(t, cerrdefs.IsConflict(err))
assert.Check(t, is.ErrorContains(err, testName))
err = c.SecretRemove(ctx, secretID)
assert.NilError(t, err)
_, _, err = c.SecretInspectWithRaw(ctx, secretID)
assert.Check(t, errdefs.IsNotFound(err))
assert.Check(t, cerrdefs.IsNotFound(err))
assert.Check(t, is.ErrorContains(err, secretID))
err = c.SecretRemove(ctx, "non-existing")
assert.Check(t, errdefs.IsNotFound(err))
assert.Check(t, cerrdefs.IsNotFound(err))
assert.Check(t, is.ErrorContains(err, "non-existing"))
testName = "test_secret_with_labels_" + t.Name()
@@ -217,7 +217,7 @@ func TestSecretsUpdate(t *testing.T) {
// this test will produce an error in func UpdateSecret
insp.Spec.Data = []byte("TESTINGDATA2")
err = c.SecretUpdate(ctx, secretID, insp.Version, insp.Spec)
assert.Check(t, errdefs.IsInvalidParameter(err))
assert.Check(t, cerrdefs.IsInvalidArgument(err))
assert.Check(t, is.ErrorContains(err, "only updates to Labels are allowed"))
}

View File

@@ -7,11 +7,11 @@ import (
"testing"
"time"
cerrdefs "github.com/containerd/errdefs"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
swarmtypes "github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/client"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/integration/internal/network"
"github.com/docker/docker/integration/internal/swarm"
"github.com/docker/docker/testutil"
@@ -165,7 +165,7 @@ func TestCreateServiceConflict(t *testing.T) {
spec := swarm.CreateServiceSpec(t, serviceSpec...)
_, err := c.ServiceCreate(ctx, spec, swarmtypes.ServiceCreateOptions{})
assert.Check(t, errdefs.IsConflict(err))
assert.Check(t, cerrdefs.IsConflict(err))
assert.ErrorContains(t, err, "service "+serviceName+" already exists")
}

View File

@@ -8,11 +8,11 @@ import (
"testing"
"time"
cerrdefs "github.com/containerd/errdefs"
containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/volume"
clientpkg "github.com/docker/docker/client"
"github.com/docker/docker/errdefs"
"github.com/docker/docker/integration/internal/build"
"github.com/docker/docker/integration/internal/container"
"github.com/docker/docker/testutil"
@@ -79,7 +79,7 @@ func TestVolumesRemove(t *testing.T) {
t.Run("volume in use", func(t *testing.T) {
err = client.VolumeRemove(ctx, vname, false)
assert.Check(t, is.ErrorType(err, errdefs.IsConflict))
assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict))
assert.Check(t, is.ErrorContains(err, "volume is in use"))
})
@@ -95,7 +95,7 @@ func TestVolumesRemove(t *testing.T) {
t.Run("non-existing volume", func(t *testing.T) {
err = client.VolumeRemove(ctx, "no_such_volume", false)
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
})
t.Run("non-existing volume force", func(t *testing.T) {
@@ -131,7 +131,7 @@ func TestVolumesRemoveSwarmEnabled(t *testing.T) {
t.Run("volume in use", func(t *testing.T) {
err = client.VolumeRemove(ctx, vname, false)
assert.Check(t, is.ErrorType(err, errdefs.IsConflict))
assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict))
assert.Check(t, is.ErrorContains(err, "volume is in use"))
})
@@ -147,7 +147,7 @@ func TestVolumesRemoveSwarmEnabled(t *testing.T) {
t.Run("non-existing volume", func(t *testing.T) {
err = client.VolumeRemove(ctx, "no_such_volume", false)
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
})
t.Run("non-existing volume force", func(t *testing.T) {