switch usage directly to errdefs.(ErrAlreadyExists and ErrNotFound)

Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
This commit is contained in:
zounengren
2021-09-24 18:26:58 +08:00
parent 45e0e5a77e
commit fcffe0c83a
19 changed files with 87 additions and 91 deletions

View File

@@ -21,10 +21,10 @@ import (
"strings"
"testing"
"github.com/containerd/containerd/errdefs"
"github.com/opencontainers/go-digest/digestset"
assertlib "github.com/stretchr/testify/assert"
storeutil "github.com/containerd/containerd/pkg/cri/store"
)
func TestInternalStore(t *testing.T) {
@@ -128,7 +128,7 @@ func TestInternalStore(t *testing.T) {
t.Logf("should be able to delete image")
s.delete(truncID, newRef)
got, err = s.get(truncID)
assert.Equal(storeutil.ErrNotExist, err)
assert.Equal(errdefs.ErrNotFound, err)
assert.Equal(Image{}, got)
imageNum--
@@ -241,7 +241,7 @@ func TestImageStore(t *testing.T) {
if test.image == nil {
// Shouldn't be able to index by removed ref.
id, err := s.Resolve(test.ref)
assert.Equal(storeutil.ErrNotExist, err)
assert.Equal(errdefs.ErrNotFound, err)
assert.Empty(id)
}
}