interop fixes

This commit is contained in:
Giovanni Petrantoni 2020-09-12 11:45:53 +09:00
parent edc055c1e8
commit 13b623bc81
3 changed files with 10 additions and 8 deletions

View File

@ -8,8 +8,8 @@
## those terms. ## those terms.
## This module implementes API for `go-libp2p-daemon`. ## This module implementes API for `go-libp2p-daemon`.
import os, osproc, strutils, tables, strtabs import std/[os, osproc, strutils, tables, strtabs]
import chronos import chronos, chronicles
import ../varint, ../multiaddress, ../multicodec, ../cid, ../peerid import ../varint, ../multiaddress, ../multicodec, ../cid, ../peerid
import ../wire, ../multihash, ../protobuf/minprotobuf import ../wire, ../multihash, ../protobuf/minprotobuf
import ../crypto/crypto import ../crypto/crypto
@ -737,10 +737,12 @@ proc newDaemonApi*(flags: set[P2PDaemonFlags] = {},
opt.add $address opt.add $address
args.add(opt) args.add(opt)
args.add("-noise=true") args.add("-noise=true")
args.add("-quic=false")
args.add("-listen=" & $api.address) args.add("-listen=" & $api.address)
# We are trying to get absolute daemon path. # We are trying to get absolute daemon path.
let cmd = findExe(daemon) let cmd = findExe(daemon)
trace "p2pd cmd", cmd, args
if len(cmd) == 0: if len(cmd) == 0:
raise newException(DaemonLocalError, "Could not find daemon executable!") raise newException(DaemonLocalError, "Could not find daemon executable!")

View File

@ -18,9 +18,7 @@ randomize()
proc generateNodes*( proc generateNodes*(
num: Natural, num: Natural,
secureManagers: openarray[SecureProtocol] = [ secureManagers: openarray[SecureProtocol] = [
# array cos order matters SecureProtocol.Noise
SecureProtocol.Secio,
SecureProtocol.Noise,
], ],
msgIdProvider: MsgIdProvider = nil, msgIdProvider: MsgIdProvider = nil,
gossip: bool = false, gossip: bool = false,

View File

@ -141,7 +141,7 @@ proc testPubSubNodePublish(gossip: bool = false,
let daemonNode = await newDaemonApi(flags) let daemonNode = await newDaemonApi(flags)
let daemonPeer = await daemonNode.identity() let daemonPeer = await daemonNode.identity()
let nativeNode = newStandardSwitch( let nativeNode = newStandardSwitch(
secureManagers = [SecureProtocol.Secio], secureManagers = [SecureProtocol.Noise],
outTimeout = 5.minutes) outTimeout = 5.minutes)
let pubsub = if gossip: let pubsub = if gossip:
@ -206,6 +206,8 @@ suite "Interop":
# # echo tracker.dump() # # echo tracker.dump()
# # check tracker.isLeaked() == false # # check tracker.isLeaked() == false
# TODO: this test is failing sometimes on windows
# For some reason we receive EOF before test 4 sometimes
test "native -> daemon multiple reads and writes": test "native -> daemon multiple reads and writes":
proc runTests(): Future[bool] {.async.} = proc runTests(): Future[bool] {.async.} =
var protos = @["/test-stream"] var protos = @["/test-stream"]
@ -267,7 +269,7 @@ suite "Interop":
copyMem(addr expect[0], addr buffer.buffer[0], len(expect)) copyMem(addr expect[0], addr buffer.buffer[0], len(expect))
let nativeNode = newStandardSwitch( let nativeNode = newStandardSwitch(
secureManagers = [SecureProtocol.Secio], secureManagers = [SecureProtocol.Noise],
outTimeout = 5.minutes) outTimeout = 5.minutes)
let awaiters = await nativeNode.start() let awaiters = await nativeNode.start()
@ -361,7 +363,7 @@ suite "Interop":
proto.codec = protos[0] # codec proto.codec = protos[0] # codec
let nativeNode = newStandardSwitch( let nativeNode = newStandardSwitch(
secureManagers = [SecureProtocol.Secio], outTimeout = 5.minutes) secureManagers = [SecureProtocol.Noise], outTimeout = 5.minutes)
nativeNode.mount(proto) nativeNode.mount(proto)