diff --git a/test/integration/tools/node.js b/test/integration/tools/node.js index bea8fb7b7724532b7a605e3cc1cd9e50c42f7c48..cb65f6ff450334decefebb12794c0b3892e174c6 100644 --- a/test/integration/tools/node.js +++ b/test/integration/tools/node.js @@ -131,7 +131,9 @@ function Node (dbName, options) { // Launching server that.server = server; started = true; - next(); + server.PeeringService.generateSelfPeer(server.conf, 0) + .then(() => next()) + .catch(next) }, function (next) { that.http = contacter(options.remoteipv4, options.remoteport); diff --git a/test/integration/tools/toolbox.ts b/test/integration/tools/toolbox.ts index 80708cd07ef7f2a8ff3ea2df3dcab8880693b368..e28f3292d2c7c9aa4e68bd4d7a01477e9034a14c 100644 --- a/test/integration/tools/toolbox.ts +++ b/test/integration/tools/toolbox.ts @@ -674,11 +674,12 @@ export const simpleWS2PNetwork: (s1: TestingServer, s2: TestingServer) => Promis const cluster1 = WS2PCluster.plugOn(s1._server) const cluster2 = WS2PCluster.plugOn(s2._server) const ws2ps = await cluster1.listen('localhost', port) - const ws2pc = await cluster2.connect('localhost', port, new WS2PServerMessageHandler(s2._server, cluster2), s1._server.conf.pair.pub) - - await new Promise(res => { + const connexionPromise = new Promise(res => { ws2ps.on('newConnection', res) }) + const ws2pc = await cluster2.connect('localhost', port, new WS2PServerMessageHandler(s2._server, cluster2), s1._server.conf.pair.pub) + + await connexionPromise w1 = await ws2ps.getConnection(clientPub) if (!w1) { throw "Connection coming from " + clientPub + " was not found"