mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
container: replace uses of errdefs package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/v2/pkg/cio"
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
"github.com/containerd/log"
|
||||
"github.com/containerd/platforms"
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
@@ -814,7 +815,7 @@ func (container *Container) RestoreTask(ctx context.Context, client libcontainer
|
||||
return err
|
||||
}
|
||||
container.task, err = container.ctr.AttachTask(ctx, container.InitializeStdio)
|
||||
if err != nil && !errdefs.IsNotFound(err) {
|
||||
if err != nil && !cerrdefs.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/google/uuid"
|
||||
"gotest.tools/v3/assert"
|
||||
@@ -87,7 +87,7 @@ func TestNames(t *testing.T) {
|
||||
assert.Check(t, db.ReserveName("name2", "containerid2"))
|
||||
|
||||
err = db.ReserveName("name2", "containerid3")
|
||||
assert.Check(t, is.ErrorType(err, errdefs.IsConflict))
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsConflict))
|
||||
assert.Check(t, is.Error(err, "name is reserved"))
|
||||
|
||||
// Releasing a name allows the name to point to something else later.
|
||||
@@ -105,7 +105,7 @@ func TestNames(t *testing.T) {
|
||||
assert.Check(t, is.Equal("containerid3", id))
|
||||
|
||||
_, err = view.GetID("notreserved")
|
||||
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
|
||||
assert.Check(t, is.Error(err, "name is not reserved"))
|
||||
|
||||
// Releasing and re-reserving a name doesn't affect the snapshot.
|
||||
@@ -163,7 +163,7 @@ func TestTruncIndex(t *testing.T) {
|
||||
|
||||
// Get on an empty index
|
||||
_, err = db.GetByPrefix("foobar")
|
||||
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
|
||||
|
||||
// Add an id
|
||||
const id = "99b36c2c326ccc11e726eee6ee78a0baf166ef96"
|
||||
|
||||
Reference in New Issue
Block a user