Update tests to use ipld.IsNotFound to check for notfound errors
This commit was moved from ipfs/interface-go-ipfs-core@01ee9419a28353cab04979f0791133df9869f30a This commit was moved from ipfs/boxo@2263eca4a44789edb3c0d244c961c12bcb1585ad
Hector Sanjuan committed
Mar 2, 2022 at 16:44 UTC
49e2b34be58f7132851388652ec1da250bf13c20
2 files changed
+8
-5
core/coreiface/tests/block.go
+3
-2
@@ -8,6 +8,7 @@ import (
8
"strings"
9
"testing"
10
11
+ ipld "github.com/ipfs/go-ipld-format"
12
coreiface "github.com/ipfs/interface-go-ipfs-core"
13
opt "github.com/ipfs/interface-go-ipfs-core/options"
14
"github.com/ipfs/interface-go-ipfs-core/path"
@@ -179,7 +180,7 @@ func (tp *TestSuite) TestBlockRm(t *testing.T) {
180
if err == nil {
181
t.Fatal("expected err to exist")
182
}
182
- if !strings.Contains(err.Error(), "blockservice: key not found") {
183
+ if !ipld.IsNotFound(err) {
184
t.Errorf("unexpected error; %s", err.Error())
185
}
186
@@ -187,7 +188,7 @@ func (tp *TestSuite) TestBlockRm(t *testing.T) {
188
if err == nil {
189
t.Fatal("expected err to exist")
190
}
190
- if !strings.Contains(err.Error(), "blockstore: block not found") {
191
+ if !strings.Contains(err.Error(), "not found") {
192
t.Errorf("unexpected error; %s", err.Error())
193
}
194
core/coreiface/tests/unixfs.go
+5
-3
@@ -5,7 +5,6 @@ import (
5
"context"
6
"encoding/hex"
7
"fmt"
8
- "github.com/ipfs/interface-go-ipfs-core/path"
8
"io"
9
"io/ioutil"
10
"math"
@@ -16,12 +15,15 @@ import (
15
"sync"
16
"testing"
17
18
+ "github.com/ipfs/interface-go-ipfs-core/path"
19
+
20
coreiface "github.com/ipfs/interface-go-ipfs-core"
21
"github.com/ipfs/interface-go-ipfs-core/options"
22
23
"github.com/ipfs/go-cid"
23
- "github.com/ipfs/go-ipfs-files"
24
+ files "github.com/ipfs/go-ipfs-files"
25
cbor "github.com/ipfs/go-ipld-cbor"
26
+ ipld "github.com/ipfs/go-ipld-format"
27
mdag "github.com/ipfs/go-merkledag"
28
"github.com/ipfs/go-unixfs"
29
"github.com/ipfs/go-unixfs/importer/helpers"
@@ -576,7 +578,7 @@ func (tp *TestSuite) TestAddHashOnly(t *testing.T) {
578
if err == nil {
579
t.Fatal("expected an error")
580
}
579
- if !strings.Contains(err.Error(), "blockservice: key not found") {
581
+ if !ipld.IsNotFound(err) {
582
t.Errorf("unxepected error: %s", err.Error())
583
}
584
}