switch usage directly to errdefs.(ErrAlreadyExists and ErrNotFound)
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
This commit is contained in:
@@ -19,9 +19,8 @@ package snapshot
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
snapshot "github.com/containerd/containerd/snapshots"
|
||||
|
||||
"github.com/containerd/containerd/pkg/cri/store"
|
||||
)
|
||||
|
||||
// Snapshot contains the information about the snapshot.
|
||||
@@ -65,7 +64,7 @@ func (s *Store) Get(key string) (Snapshot, error) {
|
||||
if sn, ok := s.snapshots[key]; ok {
|
||||
return sn, nil
|
||||
}
|
||||
return Snapshot{}, store.ErrNotExist
|
||||
return Snapshot{}, errdefs.ErrNotFound
|
||||
}
|
||||
|
||||
// List lists all snapshots.
|
||||
|
||||
@@ -20,10 +20,10 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
snapshot "github.com/containerd/containerd/snapshots"
|
||||
assertlib "github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/containerd/containerd/pkg/cri/store"
|
||||
assertlib "github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestSnapshotStore(t *testing.T) {
|
||||
@@ -80,5 +80,5 @@ func TestSnapshotStore(t *testing.T) {
|
||||
t.Logf("get should return empty struct and ErrNotExist after deletion")
|
||||
sn, err := s.Get(testKey)
|
||||
assert.Equal(Snapshot{}, sn)
|
||||
assert.Equal(store.ErrNotExist, err)
|
||||
assert.Equal(errdefs.ErrNotFound, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user