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,13 +21,13 @@ import (
"testing"
"time"
"github.com/containerd/containerd/errdefs"
cio "github.com/containerd/containerd/pkg/cri/io"
"github.com/containerd/containerd/pkg/cri/store/label"
"github.com/opencontainers/selinux/go-selinux"
assertlib "github.com/stretchr/testify/assert"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
cio "github.com/containerd/containerd/pkg/cri/io"
"github.com/containerd/containerd/pkg/cri/store"
)
func TestContainerStore(t *testing.T) {
@@ -183,7 +183,7 @@ func TestContainerStore(t *testing.T) {
truncID := genTruncIndex(testID)
t.Logf("add should return already exists error for duplicated container")
assert.Equal(store.ErrAlreadyExist, s.Add(v))
assert.Equal(errdefs.ErrAlreadyExists, s.Add(v))
t.Logf("should be able to delete container")
s.Delete(truncID)
@@ -194,7 +194,7 @@ func TestContainerStore(t *testing.T) {
t.Logf("get should return not exist error after deletion")
c, err := s.Get(truncID)
assert.Equal(Container{}, c)
assert.Equal(store.ErrNotExist, err)
assert.Equal(errdefs.ErrNotFound, err)
}
if selinux.GetEnabled() {