mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-06-06 14:10:02 +00:00
fix(tests): more v2.0.0 API migrations (rng template, PeerId.random, etc.)
- tests/test_wakunode.nim: add std/options for Option.some disambiguation - tests/test_peer_manager.nim: replace .withRng(rng) with .withRng( crypto.newRng()); PeerId.random() now takes Rng - tests/test_waku_keepalive.nim: Ping.new now requires rng: Rng arg - tests/test_waku_dnsdisc.nim: qualify ambiguous rng as common.rng()
This commit is contained in:
parent
328e11df4f
commit
cc71244499
@ -955,7 +955,11 @@ procSuite "Peer Manager":
|
||||
|
||||
# Create peer manager
|
||||
let pm = PeerManager.new(
|
||||
switch = SwitchBuilder.new().withRng(rng).withMplex().withNoise().build(),
|
||||
switch = SwitchBuilder.new()
|
||||
.withRng(crypto.newRng())
|
||||
.withMplex()
|
||||
.withNoise()
|
||||
.build(),
|
||||
storage = nil,
|
||||
)
|
||||
|
||||
@ -1013,7 +1017,7 @@ procSuite "Peer Manager":
|
||||
let pm = PeerManager.new(
|
||||
switch = SwitchBuilder
|
||||
.new()
|
||||
.withRng(rng)
|
||||
.withRng(crypto.newRng())
|
||||
.withMplex()
|
||||
.withNoise()
|
||||
.withPeerStore(peerStoreSize)
|
||||
@ -1027,7 +1031,7 @@ procSuite "Peer Manager":
|
||||
let pm = PeerManager.new(
|
||||
switch = SwitchBuilder
|
||||
.new()
|
||||
.withRng(rng)
|
||||
.withRng(crypto.newRng())
|
||||
.withMplex()
|
||||
.withNoise()
|
||||
.withPeerStore(25)
|
||||
@ -1040,7 +1044,7 @@ procSuite "Peer Manager":
|
||||
|
||||
# Create 30 peers and add them to the peerstore
|
||||
let peers = toSeq(1 .. 30)
|
||||
.mapIt(parsePeerInfo("/ip4/0.0.0.0/tcp/0/p2p/" & $PeerId.random().get()))
|
||||
.mapIt(parsePeerInfo("/ip4/0.0.0.0/tcp/0/p2p/" & $PeerId.random(crypto.newRng()).get()))
|
||||
.filterIt(it.isOk())
|
||||
.mapIt(it.value)
|
||||
for p in peers:
|
||||
@ -1091,7 +1095,7 @@ procSuite "Peer Manager":
|
||||
let pm = PeerManager.new(
|
||||
switch = SwitchBuilder
|
||||
.new()
|
||||
.withRng(rng)
|
||||
.withRng(crypto.newRng())
|
||||
.withMplex()
|
||||
.withNoise()
|
||||
.withPeerStore(25)
|
||||
@ -1148,7 +1152,7 @@ procSuite "Peer Manager":
|
||||
let pm = PeerManager.new(
|
||||
switch = SwitchBuilder
|
||||
.new()
|
||||
.withRng(rng)
|
||||
.withRng(crypto.newRng())
|
||||
.withMplex()
|
||||
.withNoise()
|
||||
.withPeerStore(25)
|
||||
@ -1164,7 +1168,7 @@ procSuite "Peer Manager":
|
||||
let pm = PeerManager.new(
|
||||
switch = SwitchBuilder
|
||||
.new()
|
||||
.withRng(rng)
|
||||
.withRng(crypto.newRng())
|
||||
.withMplex()
|
||||
.withNoise()
|
||||
.withPeerStore(25)
|
||||
@ -1178,7 +1182,7 @@ procSuite "Peer Manager":
|
||||
let pm = PeerManager.new(
|
||||
switch = SwitchBuilder
|
||||
.new()
|
||||
.withRng(rng)
|
||||
.withRng(crypto.newRng())
|
||||
.withMplex()
|
||||
.withNoise()
|
||||
.withPeerStore(25)
|
||||
@ -1327,7 +1331,7 @@ procSuite "Peer Manager":
|
||||
|
||||
# Create peer manager
|
||||
let pm = PeerManager.new(
|
||||
switch = SwitchBuilder.new().withRng(rng()).withMplex().withNoise().build(),
|
||||
switch = SwitchBuilder.new().withRng(crypto.newRng()).withMplex().withNoise().build(),
|
||||
storage = nil,
|
||||
)
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ suite "Waku DNS Discovery":
|
||||
)
|
||||
.get() # No link entries
|
||||
|
||||
let treeKeys = keys.KeyPair.random(rng[])
|
||||
let treeKeys = keys.KeyPair.random(common.rng()[])
|
||||
|
||||
# Sign tree
|
||||
check:
|
||||
|
||||
@ -38,7 +38,7 @@ suite "Waku Keepalive":
|
||||
(await node2.mountRelay()).isOkOr:
|
||||
assert false, "Failed to mount relay"
|
||||
|
||||
let pingProto = Ping.new(handler = pingHandler)
|
||||
let pingProto = Ping.new(handler = pingHandler, rng = crypto.newRng())
|
||||
await pingProto.start()
|
||||
node2.switch.mount(pingProto)
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{.used.}
|
||||
|
||||
import
|
||||
std/[sequtils, strutils, net],
|
||||
std/[options, sequtils, strutils, net],
|
||||
stew/byteutils,
|
||||
testutils/unittests,
|
||||
chronicles,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user