From fff059e6e74f2f963feb26d3c3cbb0ef5065c059 Mon Sep 17 00:00:00 2001 From: haad Date: Sat, 2 Dec 2017 13:47:16 +0100 Subject: [PATCH] Remove obsolete code from tests, speed peering for replication tests --- test/docstore.test.js | 6 +----- test/eventlog.test.js | 6 +----- test/feed.test.js | 6 +----- test/kvstore.test.js | 6 +----- test/replicate-and-load.test.js | 3 +++ test/replicate.test.js | 3 +++ 6 files changed, 10 insertions(+), 20 deletions(-) diff --git a/test/docstore.test.js b/test/docstore.test.js index ba15fd2..28ad4bd 100644 --- a/test/docstore.test.js +++ b/test/docstore.test.js @@ -12,23 +12,19 @@ const ipfsPath = './orbitdb/tests/docstore/ipfs' describe('orbit-db - Document Store', function() { this.timeout(config.timeout) - let ipfs, orbitdb1, orbitdb2, db + let ipfs, orbitdb1, db before(async () => { config.daemon1.repo = ipfsPath rmrf.sync(config.daemon1.repo) ipfs = await startIpfs(config.daemon1) orbitdb1 = new OrbitDB(ipfs, dbPath + '/1') - orbitdb2 = new OrbitDB(ipfs, dbPath + '/2') }) after(() => { if(orbitdb1) orbitdb1.disconnect() - if(orbitdb2) - orbitdb2.disconnect() - if (ipfs) ipfs.stop() }) diff --git a/test/eventlog.test.js b/test/eventlog.test.js index 8116041..e94d378 100644 --- a/test/eventlog.test.js +++ b/test/eventlog.test.js @@ -15,7 +15,7 @@ const ipfsPath = './orbitdb/tests/eventlog/ipfs' describe('orbit-db - Eventlog', function() { this.timeout(config.timeout) - let ipfs, orbitdb1, orbitdb2, db + let ipfs, orbitdb1, db before(async () => { config.daemon1.repo = ipfsPath @@ -23,16 +23,12 @@ describe('orbit-db - Eventlog', function() { rmrf.sync(dbPath) ipfs = await startIpfs(config.daemon1) orbitdb1 = new OrbitDB(ipfs, dbPath + '/1') - orbitdb2 = new OrbitDB(ipfs, dbPath + '/2') }) after(async () => { if(orbitdb1) orbitdb1.stop() - if(orbitdb2) - orbitdb2.stop() - if (ipfs) await ipfs.stop() }) diff --git a/test/feed.test.js b/test/feed.test.js index 92e4858..7c62b13 100644 --- a/test/feed.test.js +++ b/test/feed.test.js @@ -15,7 +15,7 @@ const ipfsPath = './orbitdb/tests/feed/ipfs' describe('orbit-db - Feed', function() { this.timeout(config.timeout) - let ipfs, orbitdb1, orbitdb2, db, address + let ipfs, orbitdb1, db, address before(async () => { config.daemon1.repo = ipfsPath @@ -23,16 +23,12 @@ describe('orbit-db - Feed', function() { rmrf.sync(dbPath) ipfs = await startIpfs(config.daemon1) orbitdb1 = new OrbitDB(ipfs, dbPath + '/1') - orbitdb2 = new OrbitDB(ipfs, dbPath + '/2') }) after(async () => { if(orbitdb1) orbitdb1.stop() - if(orbitdb2) - orbitdb2.stop() - if (ipfs) await ipfs.stop() }) diff --git a/test/kvstore.test.js b/test/kvstore.test.js index 5cb7e09..b5f5be5 100644 --- a/test/kvstore.test.js +++ b/test/kvstore.test.js @@ -12,7 +12,7 @@ const ipfsPath = './orbitdb/tests/kvstore/ipfs' describe('orbit-db - Key-Value Store', function() { this.timeout(config.timeout) - let ipfs, orbitdb1, orbitdb2, db + let ipfs, orbitdb1, db before(async () => { config.daemon1.repo = ipfsPath @@ -20,16 +20,12 @@ describe('orbit-db - Key-Value Store', function() { rmrf.sync(dbPath) ipfs = await startIpfs(config.daemon1) orbitdb1 = new OrbitDB(ipfs, dbPath + '/1') - orbitdb2 = new OrbitDB(ipfs, dbPath + '/2') }) after(async () => { if(orbitdb1) orbitdb1.stop() - if(orbitdb2) - orbitdb2.stop() - if (ipfs) await ipfs.stop() }) diff --git a/test/replicate-and-load.test.js b/test/replicate-and-load.test.js index 48bee34..f7c8deb 100644 --- a/test/replicate-and-load.test.js +++ b/test/replicate-and-load.test.js @@ -28,6 +28,9 @@ describe('orbit-db - Replicate and Load', function() { rmrf.sync(dbPath2) ipfs1 = await startIpfs(config.daemon1) ipfs2 = await startIpfs(config.daemon2) + // Connect the peers manually to speed up test times + await ipfs2.swarm.connect(ipfs1._peerInfo.multiaddrs._multiaddrs[0].toString()) + await ipfs1.swarm.connect(ipfs2._peerInfo.multiaddrs._multiaddrs[0].toString()) orbitdb1 = new OrbitDB(ipfs1, dbPath1) orbitdb2 = new OrbitDB(ipfs2, dbPath2) }) diff --git a/test/replicate.test.js b/test/replicate.test.js index 144e1e2..aced74b 100644 --- a/test/replicate.test.js +++ b/test/replicate.test.js @@ -28,6 +28,9 @@ describe('orbit-db - Replication', function() { rmrf.sync(dbPath2) ipfs1 = await startIpfs(config.daemon1) ipfs2 = await startIpfs(config.daemon2) + // Connect the peers manually to speed up test times + await ipfs2.swarm.connect(ipfs1._peerInfo.multiaddrs._multiaddrs[0].toString()) + await ipfs1.swarm.connect(ipfs2._peerInfo.multiaddrs._multiaddrs[0].toString()) orbitdb1 = new OrbitDB(ipfs1, dbPath1) orbitdb2 = new OrbitDB(ipfs2, dbPath2) })