Skip to content

Commit

Permalink
fix(tests): panic during sharness
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Apr 23, 2022
1 parent 99f430c commit 747c114
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions core/node/libp2p/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ func AutoRelayFeeder(lc fx.Lifecycle, h host.Host, peerChan chan peer.AddrInfo,
case <-ctx.Done():
return
}
// TODO: refactor AutoRelayFeeder, for now we skip it if dht missing to fix sharness panics
if dht == nil {
fmt.Println("AutoRelayFeeder: noop due to missing dht.WAN")
continue
}
closestPeers, err := dht.WAN.GetClosestPeers(ctx, h.ID().String())
if err != nil {
fmt.Println(err)
Expand Down
1 change: 1 addition & 0 deletions test/sharness/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ lib/sharness/
test-results/
trash directory.*.sh/
plugins
*.DS_Store
2 changes: 1 addition & 1 deletion test/sharness/t0160-resolve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ test_resolve_cmd_b32() {
local self_hash_b32libp2pkey=$(echo $self_hash | ipfs cid format -v 1 -b b --codec libp2p-key)
test_expect_success "resolve of /ipns/{cidv1} with multicodec other than libp2p-key returns a meaningful error" '
test_expect_code 1 ipfs resolve /ipns/$self_hash_b32protobuf 2>cidcodec_error &&
grep "Error: peer ID represented as CIDv1 require libp2p-key multicodec: retry with /ipns/$self_hash_b32libp2pkey" cidcodec_error
test_should_contain "Error: peer ID represented as CIDv1 require libp2p-key multicodec: retry with /ipns/$self_hash_b32libp2pkey" cidcodec_error
'
}

Expand Down

0 comments on commit 747c114

Please sign in to comment.