Remove mock and comment test.

This commit is contained in:
Alejandro Cabeza Romero 2024-08-28 18:00:08 +02:00
parent e53d041305
commit 0db9812b38
No known key found for this signature in database
GPG Key ID: DA3D14AE478030FD
2 changed files with 33 additions and 12 deletions

View File

@ -32,7 +32,7 @@ import
protocols/pubsub/rpc/messages,
]
import ../../libp2p/protocols/pubsub/errors as pubsub_errors
import ../helpers, ../utils/[async, futures, async, mock]
import ../helpers, ../utils/[async, futures, async, mock, tests]
proc `$`(peer: PubSubPeer): string =
shortLog(peer)
@ -278,14 +278,9 @@ suite "GossipSub":
await allFuturesThrowing(nodes[0].switch.stop(), nodes[1].switch.stop())
asyncTest "GossipSub unsub - resub faster than backoff":
# Mock replenishFanout so it doesn't interfere with publishing, otherwise it's used as a backup mechanism during backoff period
let backup = behavior.replenishFanout
mock(behavior.replenishFanout):
proc mockedReplenishFanout(g: GossipSub) {.async.} =
discard
mockedReplenishFanout
xasyncTest "GossipSub unsub - resub faster than backoff":
# For this test to work we'd require a way to disable fanout.
# There's not a way to toggle it, and mocking it didn't work as there's not a reliable mock available.
# Instantiate handlers and validators
var handlerFut0 = newFuture[bool]()
@ -362,9 +357,6 @@ suite "GossipSub":
handlerFut1.toResult().isOk()
handlerFut0.toResult().error() == "Future still not finished."
# Cleanup
mock(behavior.replenishFanout):
backup
await allFuturesThrowing(nodes[0].switch.stop(), nodes[1].switch.stop())
await allFuturesThrowing(nodesFut.concat())

29
tests/utils/tests.nim Normal file
View File

@ -0,0 +1,29 @@
import testutils/unittests
template xsuite*(name: string, body: untyped) =
discard
template suitex*(name: string, body: untyped) =
discard
template xprocSuite*(name: string, body: untyped) =
discard
template procSuitex*(name: string, body: untyped) =
discard
template xtest*(name: string, body: untyped) =
test name:
skip()
template testx*(name: string, body: untyped) =
test name:
skip()
template xasyncTest*(name: string, body: untyped) =
test name:
skip()
template asyncTestx*(name: string, body: untyped) =
test name:
skip()