Replace errors.Cause() with errors.Is()
Dependencies may be switching to use the new `%w` formatting option to wrap errors; switching to use `errors.Is()` makes sure that we are still able to unwrap the error and detect the underlying cause. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -24,7 +24,6 @@ import (
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/containerd/containerd/leases"
|
||||
"github.com/opencontainers/image-spec/identity"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func TestLeaseResources(t *testing.T) {
|
||||
@@ -108,7 +107,7 @@ func TestLeaseResources(t *testing.T) {
|
||||
}
|
||||
|
||||
// config should be removed but the snapshotter should exist
|
||||
if _, err := cs.Info(ctx, cfgDesc.Digest); errors.Cause(err) != errdefs.ErrNotFound {
|
||||
if _, err := cs.Info(ctx, cfgDesc.Digest); !errdefs.IsNotFound(err) {
|
||||
t.Fatalf("expected error(%v), but got(%v)", errdefs.ErrNotFound, err)
|
||||
}
|
||||
|
||||
@@ -135,7 +134,7 @@ func TestLeaseResources(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if _, err := sn.Stat(ctx, chainID.String()); errors.Cause(err) != errdefs.ErrNotFound {
|
||||
if _, err := sn.Stat(ctx, chainID.String()); !errdefs.IsNotFound(err) {
|
||||
t.Fatalf("expected error(%v), but got(%v)", errdefs.ErrNotFound, err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user