switch to github.com/containerd/errdefs for error-matching
replace uses of docker/errdefs.IsXXX utilities with their containerd/errdefs equivalent. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@ -8,7 +8,7 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/errdefs"
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
"gotest.tools/v3/assert"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
@ -26,7 +26,7 @@ func testMetadata(name string) Metadata {
|
||||
func TestMetadataGetNotExisting(t *testing.T) {
|
||||
testee := metadataStore{root: t.TempDir(), config: testCfg}
|
||||
_, err := testee.get("noexist")
|
||||
assert.ErrorType(t, err, errdefs.IsNotFound)
|
||||
assert.ErrorType(t, err, cerrdefs.IsNotFound)
|
||||
}
|
||||
|
||||
func TestMetadataCreateGetRemove(t *testing.T) {
|
||||
@ -60,7 +60,7 @@ func TestMetadataCreateGetRemove(t *testing.T) {
|
||||
assert.NilError(t, testee.remove("test-context"))
|
||||
assert.NilError(t, testee.remove("test-context")) // support duplicate remove
|
||||
_, err = testee.get("test-context")
|
||||
assert.ErrorType(t, err, errdefs.IsNotFound)
|
||||
assert.ErrorType(t, err, cerrdefs.IsNotFound)
|
||||
}
|
||||
|
||||
func TestMetadataRespectJsonAnnotation(t *testing.T) {
|
||||
|
||||
@ -17,7 +17,7 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/errdefs"
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
"gotest.tools/v3/assert"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
@ -107,7 +107,7 @@ func TestRemove(t *testing.T) {
|
||||
}))
|
||||
assert.NilError(t, s.Remove("source"))
|
||||
_, err = s.GetMetadata("source")
|
||||
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
|
||||
f, err := s.ListTLSFiles("source")
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, 0, len(f))
|
||||
@ -122,7 +122,7 @@ func TestListEmptyStore(t *testing.T) {
|
||||
func TestErrHasCorrectContext(t *testing.T) {
|
||||
_, err := New(t.TempDir(), testCfg).GetMetadata("no-exists")
|
||||
assert.ErrorContains(t, err, "no-exists")
|
||||
assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
|
||||
}
|
||||
|
||||
func TestDetectImportContentType(t *testing.T) {
|
||||
|
||||
@ -3,7 +3,7 @@ package store
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/errdefs"
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
@ -13,7 +13,7 @@ func TestTlsCreateUpdateGetRemove(t *testing.T) {
|
||||
const contextName = "test-ctx"
|
||||
|
||||
_, err := testee.getData(contextName, "test-ep", "test-data")
|
||||
assert.ErrorType(t, err, errdefs.IsNotFound)
|
||||
assert.ErrorType(t, err, cerrdefs.IsNotFound)
|
||||
|
||||
err = testee.createOrUpdate(contextName, "test-ep", "test-data", []byte("data"))
|
||||
assert.NilError(t, err)
|
||||
@ -29,7 +29,7 @@ func TestTlsCreateUpdateGetRemove(t *testing.T) {
|
||||
err = testee.removeEndpoint(contextName, "test-ep")
|
||||
assert.NilError(t, err)
|
||||
_, err = testee.getData(contextName, "test-ep", "test-data")
|
||||
assert.ErrorType(t, err, errdefs.IsNotFound)
|
||||
assert.ErrorType(t, err, cerrdefs.IsNotFound)
|
||||
}
|
||||
|
||||
func TestTlsListAndBatchRemove(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user