mirror of https://github.com/waku-org/nwaku.git
fix: node restart test issue (#2576)
* test_protocol.nim: enhance test reboot and connect - Is not necessary to start the node if the switch object has been already started - Enable an existing "Relay can receive messages after reboot and reconnect" test - Explicit reconnect to peer in "Relay can receive messages after reboot and reconnect" test * tests/waku_relay/utils: avoid starting the proto again in newTestSwitch proc With that, we avoid double start of the protocol. * bump nim-libp2p
This commit is contained in:
parent
828583adc2
commit
4a8e62ac5e
|
@ -60,13 +60,13 @@ suite "Waku Relay":
|
|||
pubsubTopicSeq = @[pubsubTopic]
|
||||
wakuMessage = fakeWakuMessage(testMessage, pubsubTopic)
|
||||
|
||||
await allFutures(switch.start(), node.start())
|
||||
await allFutures(switch.start())
|
||||
|
||||
remotePeerInfo = switch.peerInfo.toRemotePeerInfo()
|
||||
peerId = remotePeerInfo.peerId
|
||||
|
||||
asyncTeardown:
|
||||
await allFutures(switch.stop(), node.stop())
|
||||
await allFutures(switch.stop())
|
||||
|
||||
suite "Subscribe":
|
||||
asyncTest "Publish without Subscription":
|
||||
|
@ -1210,14 +1210,14 @@ suite "Waku Relay":
|
|||
await allFutures(otherSwitch.stop(), otherNode.stop())
|
||||
|
||||
suite "Security and Privacy":
|
||||
xasyncTest "Relay can receive messages after reboot and reconnect":
|
||||
asyncTest "Relay can receive messages after reboot and reconnect":
|
||||
# Given a second node connected to the first one
|
||||
let
|
||||
otherSwitch = newTestSwitch()
|
||||
otherPeerManager = PeerManager.new(otherSwitch)
|
||||
otherNode = await newTestWakuRelay(otherSwitch)
|
||||
|
||||
await allFutures(otherSwitch.start(), otherNode.start())
|
||||
await otherSwitch.start()
|
||||
let
|
||||
otherRemotePeerInfo = otherSwitch.peerInfo.toRemotePeerInfo()
|
||||
otherPeerId = otherRemotePeerInfo.peerId
|
||||
|
@ -1239,8 +1239,11 @@ suite "Waku Relay":
|
|||
await sleepAsync(500.millis)
|
||||
|
||||
# Given other node is stopped and restarted
|
||||
await allFutures(otherSwitch.stop(), otherNode.stop())
|
||||
await allFutures(otherSwitch.start(), otherNode.start())
|
||||
await otherSwitch.stop()
|
||||
await otherSwitch.start()
|
||||
|
||||
check await peerManager.connectRelay(otherRemotePeerInfo)
|
||||
|
||||
# FIXME: Once stopped and started, nodes are not considered connected, nor do they reconnect after running connectRelay, as below
|
||||
# check await otherPeerManager.connectRelay(otherRemotePeerInfo)
|
||||
|
||||
|
@ -1269,8 +1272,9 @@ suite "Waku Relay":
|
|||
(pubsubTopic, msg2) == otherHandlerFuture.read()
|
||||
|
||||
# Given node is stopped and restarted
|
||||
await allFutures(switch.stop(), node.stop())
|
||||
await allFutures(switch.start(), node.start())
|
||||
await switch.stop()
|
||||
await switch.start()
|
||||
check await peerManager.connectRelay(otherRemotePeerInfo)
|
||||
|
||||
# When sending a message from node
|
||||
handlerFuture = newPushHandlerFuture()
|
||||
|
|
|
@ -12,7 +12,6 @@ proc noopRawHandler*(): WakuRelayHandler =
|
|||
|
||||
proc newTestWakuRelay*(switch = newTestSwitch()): Future[WakuRelay] {.async.} =
|
||||
let proto = WakuRelay.new(switch).tryGet()
|
||||
await proto.start()
|
||||
|
||||
let protocolMatcher = proc(proto: string): bool {.gcsafe.} =
|
||||
return proto.startsWith(WakuRelayCodec)
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 09b3e11956459ad4c364b353b7f1067f42267997
|
||||
Subproject commit b30b2656d52ee304bd56f8f8bbf59ab82b658a36
|
|
@ -61,7 +61,6 @@ const TopicParameters = TopicParams(
|
|||
|
||||
# see: https://rfc.vac.dev/spec/29/#gossipsub-v10-parameters
|
||||
const GossipsubParameters = GossipSubParams.init(
|
||||
explicit = true,
|
||||
pruneBackoff = chronos.minutes(1),
|
||||
unsubscribeBackoff = chronos.seconds(5),
|
||||
floodPublish = true,
|
||||
|
|
Loading…
Reference in New Issue