deploy: c22c1e05bc3fc85fdf9fe119fa43ddb251afdfec

This commit is contained in:
oskarth 2021-04-28 05:35:01 +00:00
parent 71a901d22a
commit 2449e249a0
2 changed files with 56 additions and 56 deletions

View File

@ -568,67 +568,67 @@ procSuite "WakuNode":
await allFutures([node1.stop(), node2.stop()])
asyncTest "Lightpush message return success":
let
nodeKey1 = crypto.PrivateKey.random(Secp256k1, rng[])[]
node1 = WakuNode.init(nodeKey1, ValidIpAddress.init("0.0.0.0"),
Port(60000))
nodeKey2 = crypto.PrivateKey.random(Secp256k1, rng[])[]
node2 = WakuNode.init(nodeKey2, ValidIpAddress.init("0.0.0.0"),
Port(60002))
nodeKey3 = crypto.PrivateKey.random(Secp256k1, rng[])[]
node3 = WakuNode.init(nodeKey3, ValidIpAddress.init("0.0.0.0"),
Port(60003))
pubSubTopic = "test"
contentTopic = ContentTopic("/waku/2/default-content/proto")
payload = "hello world".toBytes()
message = WakuMessage(payload: payload, contentTopic: contentTopic)
# asyncTest "Lightpush message return success":
# let
# nodeKey1 = crypto.PrivateKey.random(Secp256k1, rng[])[]
# node1 = WakuNode.init(nodeKey1, ValidIpAddress.init("0.0.0.0"),
# Port(60000))
# nodeKey2 = crypto.PrivateKey.random(Secp256k1, rng[])[]
# node2 = WakuNode.init(nodeKey2, ValidIpAddress.init("0.0.0.0"),
# Port(60002))
# nodeKey3 = crypto.PrivateKey.random(Secp256k1, rng[])[]
# node3 = WakuNode.init(nodeKey3, ValidIpAddress.init("0.0.0.0"),
# Port(60003))
# pubSubTopic = "test"
# contentTopic = ContentTopic("/waku/2/default-content/proto")
# payload = "hello world".toBytes()
# message = WakuMessage(payload: payload, contentTopic: contentTopic)
# Light node, only lightpush
await node1.start()
node1.mountLightPush()
# # Light node, only lightpush
# await node1.start()
# node1.mountLightPush()
# Intermediate node
await node2.start()
node2.mountRelay(@[pubSubTopic])
node2.mountLightPush()
# # Intermediate node
# await node2.start()
# node2.mountRelay(@[pubSubTopic])
# node2.mountLightPush()
# Receiving node
await node3.start()
node3.mountRelay(@[pubSubTopic])
# # Receiving node
# await node3.start()
# node3.mountRelay(@[pubSubTopic])
discard await node1.peerManager.dialPeer(node2.peerInfo, WakuLightPushCodec)
await sleepAsync(5.seconds)
await node3.connectToNodes(@[node2.peerInfo])
# discard await node1.peerManager.dialPeer(node2.peerInfo, WakuLightPushCodec)
# await sleepAsync(5.seconds)
# await node3.connectToNodes(@[node2.peerInfo])
var completionFutLightPush = newFuture[bool]()
var completionFutRelay = newFuture[bool]()
proc relayHandler(topic: string, data: seq[byte]) {.async, gcsafe.} =
let msg = WakuMessage.init(data)
if msg.isOk():
let val = msg.value()
check:
topic == pubSubTopic
val.contentTopic == contentTopic
val.payload == payload
completionFutRelay.complete(true)
# var completionFutLightPush = newFuture[bool]()
# var completionFutRelay = newFuture[bool]()
# proc relayHandler(topic: string, data: seq[byte]) {.async, gcsafe.} =
# let msg = WakuMessage.init(data)
# if msg.isOk():
# let val = msg.value()
# check:
# topic == pubSubTopic
# val.contentTopic == contentTopic
# val.payload == payload
# completionFutRelay.complete(true)
node3.subscribe(pubSubTopic, relayHandler)
await sleepAsync(2000.millis)
# node3.subscribe(pubSubTopic, relayHandler)
# await sleepAsync(2000.millis)
proc handler(response: PushResponse) {.gcsafe, closure.} =
debug "push response handler, expecting true"
check:
response.isSuccess == true
completionFutLightPush.complete(true)
# proc handler(response: PushResponse) {.gcsafe, closure.} =
# debug "push response handler, expecting true"
# check:
# response.isSuccess == true
# completionFutLightPush.complete(true)
# Publishing with lightpush
await node1.lightpush(pubSubTopic, message, handler)
await sleepAsync(2000.millis)
# # Publishing with lightpush
# await node1.lightpush(pubSubTopic, message, handler)
# await sleepAsync(2000.millis)
check:
(await completionFutRelay.withTimeout(5.seconds)) == true
(await completionFutLightPush.withTimeout(5.seconds)) == true
await node1.stop()
await node2.stop()
await node3.stop()
# check:
# (await completionFutRelay.withTimeout(5.seconds)) == true
# (await completionFutLightPush.withTimeout(5.seconds)) == true
# await node1.stop()
# await node2.stop()
# await node3.stop()

View File

@ -2,7 +2,7 @@
# libtool - Provide generalized library-building support services.
# Generated automatically by config.status (libbacktrace) version-unused
# Libtool was configured on host fv-az231-223:
# Libtool was configured on host fv-az132-34:
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
#
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,