swarm: fix flaky delivery tests (#18971)

pull/18975/head
Janoš Guljaš 6 years ago committed by Anton Evangelatov
parent c5c9cef5c0
commit 592bf6a59c
  1. 7
      swarm/network/stream/delivery.go
  2. 2
      swarm/network/stream/delivery_test.go

@ -259,13 +259,6 @@ func (d *Delivery) RequestFromPeers(ctx context.Context, req *network.Request) (
if sp == nil {
return true
}
// nodes that do not provide stream protocol
// should not be requested, e.g. bootnodes
if !p.HasCap("stream") {
// TODO: if we have no errors, delete this if
log.Error("Delivery.RequestFromPeers: peer doesn't have stream cap. we should have returned at sp == nil")
return true
}
spID = &id
return false
})

@ -285,7 +285,7 @@ func TestRequestFromPeers(t *testing.T) {
addr := network.RandomAddr()
to := network.NewKademlia(addr.OAddr, network.NewKadParams())
delivery := NewDelivery(to, nil)
protocolsPeer := protocols.NewPeer(p2p.NewPeer(dummyPeerID, "dummy", []p2p.Cap{{Name: "stream"}}), nil, nil)
protocolsPeer := protocols.NewPeer(p2p.NewPeer(dummyPeerID, "dummy", nil), nil, nil)
peer := network.NewPeer(&network.BzzPeer{
BzzAddr: network.RandomAddr(),
LightNode: false,

Loading…
Cancel
Save