Update tests to use ipld.IsNotFound to check for notfound errors

This commit was moved from ipfs/interface-go-ipfs-core@01ee9419a2

This commit was moved from ipfs/boxo@2263eca4a4
This commit is contained in:
Hector Sanjuan 2022-03-02 16:44:11 +01:00 committed by Jorropo
parent a83f5e6df0
commit 49e2b34be5
2 changed files with 8 additions and 5 deletions

View File

@ -8,6 +8,7 @@ import (
"strings"
"testing"
ipld "github.com/ipfs/go-ipld-format"
coreiface "github.com/ipfs/interface-go-ipfs-core"
opt "github.com/ipfs/interface-go-ipfs-core/options"
"github.com/ipfs/interface-go-ipfs-core/path"
@ -179,7 +180,7 @@ func (tp *TestSuite) TestBlockRm(t *testing.T) {
if err == nil {
t.Fatal("expected err to exist")
}
if !strings.Contains(err.Error(), "blockservice: key not found") {
if !ipld.IsNotFound(err) {
t.Errorf("unexpected error; %s", err.Error())
}
@ -187,7 +188,7 @@ func (tp *TestSuite) TestBlockRm(t *testing.T) {
if err == nil {
t.Fatal("expected err to exist")
}
if !strings.Contains(err.Error(), "blockstore: block not found") {
if !strings.Contains(err.Error(), "not found") {
t.Errorf("unexpected error; %s", err.Error())
}

View File

@ -5,7 +5,6 @@ import (
"context"
"encoding/hex"
"fmt"
"github.com/ipfs/interface-go-ipfs-core/path"
"io"
"io/ioutil"
"math"
@ -16,12 +15,15 @@ import (
"sync"
"testing"
"github.com/ipfs/interface-go-ipfs-core/path"
coreiface "github.com/ipfs/interface-go-ipfs-core"
"github.com/ipfs/interface-go-ipfs-core/options"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-ipfs-files"
files "github.com/ipfs/go-ipfs-files"
cbor "github.com/ipfs/go-ipld-cbor"
ipld "github.com/ipfs/go-ipld-format"
mdag "github.com/ipfs/go-merkledag"
"github.com/ipfs/go-unixfs"
"github.com/ipfs/go-unixfs/importer/helpers"
@ -576,7 +578,7 @@ func (tp *TestSuite) TestAddHashOnly(t *testing.T) {
if err == nil {
t.Fatal("expected an error")
}
if !strings.Contains(err.Error(), "blockservice: key not found") {
if !ipld.IsNotFound(err) {
t.Errorf("unxepected error: %s", err.Error())
}
}