mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-03 06:23:10 +00:00
* properly pass userMessageLimit to OnchainGroupManager * waku.nimble 2.2.4 Nim compiler * rm stew/shims/net import * change ValidIpAddress.init with parseIpAddress * fix serialize for zerokit * group_manager: separate if statements * protocol_types: add encode UInt32 with zeros up to 32 bytes * windows build: skip libunwind build and rm libunwind.a inlcusion step * bump nph to overcome the compilation issues with 2.2.x * bump nim-libp2p to v1.10.1
100 lines
2.2 KiB
Nim
100 lines
2.2 KiB
Nim
{.used.}
|
|
|
|
import
|
|
testutils/unittests,
|
|
chronicles,
|
|
chronos,
|
|
libp2p/crypto/crypto,
|
|
libp2p/crypto/secp,
|
|
libp2p/multiaddress,
|
|
libp2p/switch
|
|
import ../testlib/wakucore, ../testlib/wakunode
|
|
|
|
include waku/factory/waku, waku/common/enr/typed_record
|
|
|
|
suite "Wakunode2 - Waku":
|
|
test "compilation version should be reported":
|
|
## Given
|
|
let conf = defaultTestWakuConf()
|
|
|
|
let waku = Waku.new(conf).valueOr:
|
|
raiseAssert error
|
|
|
|
## When
|
|
let version = waku.version
|
|
|
|
## Then
|
|
check:
|
|
version == git_version
|
|
|
|
suite "Wakunode2 - Waku initialization":
|
|
test "peer persistence setup should be successfully mounted":
|
|
## Given
|
|
var conf = defaultTestWakuConf()
|
|
conf.peerPersistence = true
|
|
|
|
let waku = Waku.new(conf).valueOr:
|
|
raiseAssert error
|
|
|
|
check:
|
|
not waku.node.peerManager.storage.isNil()
|
|
|
|
test "node setup is successful with default configuration":
|
|
## Given
|
|
var conf = defaultTestWakuConf()
|
|
|
|
## When
|
|
var waku = Waku.new(conf).valueOr:
|
|
raiseAssert error
|
|
|
|
(waitFor startWaku(addr waku)).isOkOr:
|
|
raiseAssert error
|
|
|
|
## Then
|
|
let node = waku.node
|
|
check:
|
|
not node.isNil()
|
|
node.wakuArchive.isNil()
|
|
node.wakuStore.isNil()
|
|
not node.wakuStoreClient.isNil()
|
|
not node.wakuRendezvous.isNil()
|
|
|
|
## Cleanup
|
|
waitFor waku.stop()
|
|
|
|
test "app properly handles dynamic port configuration":
|
|
## Given
|
|
var conf = defaultTestWakuConf()
|
|
conf.networkConf.p2pTcpPort = Port(0)
|
|
|
|
## When
|
|
var waku = Waku.new(conf).valueOr:
|
|
raiseAssert error
|
|
|
|
(waitFor startWaku(addr waku)).isOkOr:
|
|
raiseAssert error
|
|
|
|
## Then
|
|
let
|
|
node = waku.node
|
|
typedNodeEnr = node.enr.toTyped()
|
|
|
|
assert typedNodeEnr.isOk(), $typedNodeEnr.error
|
|
let tcpPort = typedNodeEnr.value.tcp()
|
|
assert tcpPort.isSome()
|
|
check tcpPort.get() != 0
|
|
|
|
check:
|
|
# Waku started properly
|
|
not node.isNil()
|
|
node.wakuArchive.isNil()
|
|
node.wakuStore.isNil()
|
|
not node.wakuStoreClient.isNil()
|
|
not node.wakuRendezvous.isNil()
|
|
|
|
# DS structures are updated with dynamic ports
|
|
typedNodeEnr.get().tcp.get() != 0
|
|
|
|
## Cleanup
|
|
waitFor waku.stop()
|