Skip to content

Commit 28600d9

Browse files
committed
fix(tests): panic during sharness
1 parent 70215ab commit 28600d9

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

core/node/libp2p/routing.go

+5
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ func AutoRelayFeeder(lc fx.Lifecycle, h host.Host, peerChan chan peer.AddrInfo,
197197
case <-ctx.Done():
198198
return
199199
}
200+
// TODO: refactor AutoRelayFeeder, for now we skip it if dht missing to fix sharness panics
201+
if dht == nil {
202+
fmt.Println("AutoRelayFeeder: noop due to missing dht.WAN")
203+
continue
204+
}
200205
closestPeers, err := dht.WAN.GetClosestPeers(ctx, h.ID().String())
201206
if err != nil {
202207
fmt.Println(err)

test/sharness/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ lib/sharness/
22
test-results/
33
trash directory.*.sh/
44
plugins
5+
*.DS_Store

test/sharness/t0160-resolve.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ test_resolve_cmd_b32() {
125125
local self_hash_b32libp2pkey=$(echo $self_hash | ipfs cid format -v 1 -b b --codec libp2p-key)
126126
test_expect_success "resolve of /ipns/{cidv1} with multicodec other than libp2p-key returns a meaningful error" '
127127
test_expect_code 1 ipfs resolve /ipns/$self_hash_b32protobuf 2>cidcodec_error &&
128-
grep "Error: peer ID represented as CIDv1 require libp2p-key multicodec: retry with /ipns/$self_hash_b32libp2pkey" cidcodec_error
128+
test_should_contain "Error: peer ID represented as CIDv1 require libp2p-key multicodec: retry with /ipns/$self_hash_b32libp2pkey" cidcodec_error
129129
'
130130
}
131131

0 commit comments

Comments
 (0)