From 49c30b3ec01dd87927747f078ff130a7853d5416 Mon Sep 17 00:00:00 2001 From: haad Date: Wed, 15 Feb 2017 17:54:12 +0100 Subject: [PATCH] Run one replication test only (for @diasdavid) --- test/ipfs-daemons.conf.js | 22 ++++++++++++++++++++-- test/replicate.test.js | 9 ++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/test/ipfs-daemons.conf.js b/test/ipfs-daemons.conf.js index 224ac79..9e53847 100644 --- a/test/ipfs-daemons.conf.js +++ b/test/ipfs-daemons.conf.js @@ -6,7 +6,16 @@ module.exports = { Swarm: ['/ip4/0.0.0.0/tcp/0'], Gateway: '/ip4/0.0.0.0/tcp/0' }, - // Bootstrap: [] + Discovery: { + MDNS: { + Enabled: true, + Interval: 10 + }, + webRTCStar: { + Enabled: true + } + }, + Bootstrap: [] }, daemon2: { IpfsDataDir: '/tmp/orbit-db-tests-2', @@ -15,6 +24,15 @@ module.exports = { Swarm: ['/ip4/0.0.0.0/tcp/0'], Gateway: '/ip4/0.0.0.0/tcp/0' }, - // Bootstrap: [] + Discovery: { + MDNS: { + Enabled: true, + Interval: 10 + }, + webRTCStar: { + Enabled: true + } + }, + Bootstrap: [] }, } diff --git a/test/replicate.test.js b/test/replicate.test.js index 7e7f8ed..7df34de 100644 --- a/test/replicate.test.js +++ b/test/replicate.test.js @@ -32,10 +32,13 @@ const hasIpfsApiWithPubsub = (ipfs) => { const waitForPeers = (ipfs, channel) => { return new Promise((resolve) => { - console.log("Waiting for peers...") + console.log("Waiting for peers for '" + channel + "'...") const interval = setInterval(() => { ipfs.pubsub.peers(channel) + // The tests pass if used with swarm.peers (peers find each other) + // ipfs.swarm.peers() .then((peers) => { + // console.log(peers) if (peers.length > 0) { clearInterval(interval) resolve() @@ -72,7 +75,7 @@ const waitForPeers = (ipfs, channel) => { assert.equal(hasIpfsApiWithPubsub(ipfs2), true) client1 = new OrbitDB(ipfs1, databaseName) client2 = new OrbitDB(ipfs2, databaseName + '2') - done() + done() }) }) }) @@ -89,7 +92,7 @@ const waitForPeers = (ipfs, channel) => { db2 = client2.eventlog(databaseName, { maxHistory: 0 }) }) - it('replicates database of 1 entry', (done) => { + it.only('replicates database of 1 entry', (done) => { waitForPeers(ipfs1, databaseName + '2') .then(async(() => { db2.events.on('history', (db, data) => {