Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-ramos committed Jan 14, 2025
1 parent ba5987f commit 14870cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/pubsub/testgossipsub.nim
Original file line number Diff line number Diff line change
Expand Up @@ -940,18 +940,23 @@ suite "GossipSub":
func dumbMsgIdProvider(m: Message): Result[MessageId, ValidationResult] =
ok(newSeq[byte](10))
let
nodes = generateNodes(2, gossip = true, msgIdProvider = dumbMsgIdProvider)
nodes = generateNodes(
2,
gossip = true,
msgIdProvider = dumbMsgIdProvider,
sendIDontWantOnPublish = true,
)

nodesFut = await allFinished(nodes[0].switch.start(), nodes[1].switch.start())

await nodes[0].switch.connect(
nodes[1].switch.peerInfo.peerId, nodes[1].switch.peerInfo.addrs
)

proc handlerA(topic: string, data: seq[byte]) {.async.} =
proc handlerA(topic: string, data: seq[byte]) {.async: (raises: []).} =
discard

proc handlerB(topic: string, data: seq[byte]) {.async.} =
proc handlerB(topic: string, data: seq[byte]) {.async: (raises: []).} =
discard

nodes[0].subscribe("foobar", handlerA)
Expand Down
2 changes: 2 additions & 0 deletions tests/pubsub/utils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ proc generateNodes*(
overheadRateLimit: Opt[tuple[bytes: int, interval: Duration]] =
Opt.none(tuple[bytes: int, interval: Duration]),
gossipSubVersion: string = "",
sendIDontWantOnPublish: bool = false,
): seq[PubSub] =
for i in 0 ..< num:
let switch = newStandardSwitch(
Expand All @@ -97,6 +98,7 @@ proc generateNodes*(
p.unsubscribeBackoff = unsubscribeBackoff
p.enablePX = enablePX
p.overheadRateLimit = overheadRateLimit
p.sendIDontWantOnPublish = sendIDontWantOnPublish
p
),
)
Expand Down

0 comments on commit 14870cf

Please sign in to comment.