Disable unreliable provide cid test.

This commit is contained in:
cheatfate 2020-03-24 10:05:11 +02:00
parent 1f5d994700
commit a2acdd7933
No known key found for this signature in database
GPG Key ID: 46ADD633A7201F95
1 changed files with 24 additions and 24 deletions

View File

@ -40,33 +40,33 @@ proc connectStreamTest(): Future[bool] {.async.} =
await api2.close() await api2.close()
result = true result = true
proc provideCidTest(): Future[bool] {.async.} = # proc provideCidTest(): Future[bool] {.async.} =
var api1 = await newDaemonApi({DHTFull}) # var api1 = await newDaemonApi({DHTFull})
var api2 = await newDaemonApi({DHTFull}) # var api2 = await newDaemonApi({DHTFull})
var msg = "ethereum2-beacon-chain" # var msg = "ethereum2-beacon-chain"
var bmsg = cast[seq[byte]](msg) # var bmsg = cast[seq[byte]](msg)
var mh = MultiHash.digest("sha2-256", bmsg) # var mh = MultiHash.digest("sha2-256", bmsg)
var cid = Cid.init(CIDv1, multiCodec("dag-pb"), mh) # var cid = Cid.init(CIDv1, multiCodec("dag-pb"), mh)
var id1 = await api1.identity() # var id1 = await api1.identity()
var id2 = await api2.identity() # var id2 = await api2.identity()
await api1.connect(id2.peer, id2.addresses) # await api1.connect(id2.peer, id2.addresses)
while true: # while true:
var peers = await api1.listPeers() # var peers = await api1.listPeers()
if len(peers) > 0: # if len(peers) > 0:
break # break
await api1.dhtProvide(cid) # await api1.dhtProvide(cid)
var peers = await api2.dhtFindProviders(cid, 10) # var peers = await api2.dhtFindProviders(cid, 10)
if len(peers) == 1: # if len(peers) == 1:
if peers[0].peer == id1.peer: # if peers[0].peer == id1.peer:
result = true # result = true
await api1.close() # await api1.close()
await api2.close() # await api2.close()
proc pubsubTest(f: set[P2PDaemonFlags]): Future[bool] {.async.} = proc pubsubTest(f: set[P2PDaemonFlags]): Future[bool] {.async.} =
var pubsubData = "TEST MESSAGE" var pubsubData = "TEST MESSAGE"
@ -138,9 +138,9 @@ when isMainModule:
test "Connect/Accept peer/stream test": test "Connect/Accept peer/stream test":
check: check:
waitFor(connectStreamTest()) == true waitFor(connectStreamTest()) == true
test "Provide CID test": # test "Provide CID test":
check: # check:
waitFor(provideCidTest()) == true # waitFor(provideCidTest()) == true
test "GossipSub test": test "GossipSub test":
check: check:
waitFor(pubsubTest({PSGossipSub})) == true waitFor(pubsubTest({PSGossipSub})) == true