From e6e3bcc994582205552cf1e3bb19927fb2045345 Mon Sep 17 00:00:00 2001 From: haad <haad@headbanggames.com> Date: Fri, 30 Dec 2022 14:40:37 +0200 Subject: [PATCH] Fix replication issues --- package-lock.json | 8 ++++---- package.json | 2 +- ...tract-access-controller-integration.test.js | 2 +- ...it-db-access-controller-integration.test.js | 2 +- test/multiple-databases.test.js | 2 +- test/replicate-and-load.test.js | 2 +- test/replicate.test.js | 18 ++++++------------ 7 files changed, 15 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2201495..8a8a2d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "orbit-db-io": "github:haydenyoung/orbit-db-io#esm", "orbit-db-keystore": "github:haydenyoung/orbit-db-keystore#esm", "orbit-db-kvstore": "github:haydenyoung/orbit-db-kvstore#esm", - "orbit-db-pubsub": "github:haydenyoung/orbit-db-pubsub#esm", + "orbit-db-pubsub": "github:orbitdb/orbit-db-pubsub#esm", "orbit-db-storage-adapter": "github:orbitdb/orbit-db-storage-adapter#esm-fixes", "orbit-db-store": "github:haadcode/orbit-db-store#esm", "wherearewe": "^1.0.2" @@ -19364,7 +19364,7 @@ }, "node_modules/orbit-db-pubsub": { "version": "0.6.1", - "resolved": "git+ssh://git@github.com/haydenyoung/orbit-db-pubsub.git#093bcbe6dd4f3f9339594cebc68b9dbb73d96719", + "resolved": "git+ssh://git@github.com/orbitdb/orbit-db-pubsub.git#0d6a914485e659e116e458a8e14446de3f265806", "license": "MIT", "dependencies": { "ipfs-pubsub-peer-monitor": "github:haydenyoung/ipfs-pubsub-peer-monitor#esm", @@ -45339,8 +45339,8 @@ "requires": {} }, "orbit-db-pubsub": { - "version": "git+ssh://git@github.com/haydenyoung/orbit-db-pubsub.git#093bcbe6dd4f3f9339594cebc68b9dbb73d96719", - "from": "orbit-db-pubsub@github:haydenyoung/orbit-db-pubsub#esm", + "version": "git+ssh://git@github.com/orbitdb/orbit-db-pubsub.git#0d6a914485e659e116e458a8e14446de3f265806", + "from": "orbit-db-pubsub@github:orbitdb/orbit-db-pubsub#esm", "requires": { "ipfs-pubsub-peer-monitor": "github:haydenyoung/ipfs-pubsub-peer-monitor#esm", "logplease": "~1.2.14", diff --git a/package.json b/package.json index d10cca5..4e3426a 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "orbit-db-io": "github:haydenyoung/orbit-db-io#esm", "orbit-db-keystore": "github:haydenyoung/orbit-db-keystore#esm", "orbit-db-kvstore": "github:haydenyoung/orbit-db-kvstore#esm", - "orbit-db-pubsub": "github:haydenyoung/orbit-db-pubsub#esm", + "orbit-db-pubsub": "github:orbitdb/orbit-db-pubsub#esm", "orbit-db-storage-adapter": "github:orbitdb/orbit-db-storage-adapter#esm-fixes", "orbit-db-store": "github:haadcode/orbit-db-store#esm", "wherearewe": "^1.0.2" diff --git a/test/access-controllers/contract-access-controller-integration.test.js b/test/access-controllers/contract-access-controller-integration.test.js index 703885b..77fb4ac 100644 --- a/test/access-controllers/contract-access-controller-integration.test.js +++ b/test/access-controllers/contract-access-controller-integration.test.js @@ -179,7 +179,7 @@ Object.keys(testAPIs).forEach(API => { }) }) - describe.skip('access controls', () => { + describe('access controls', () => { it('throws error if key not permitted to write', async () => { let err try { diff --git a/test/access-controllers/orbit-db-access-controller-integration.test.js b/test/access-controllers/orbit-db-access-controller-integration.test.js index 6b882d6..24ec36e 100644 --- a/test/access-controllers/orbit-db-access-controller-integration.test.js +++ b/test/access-controllers/orbit-db-access-controller-integration.test.js @@ -139,7 +139,7 @@ Object.keys(testAPIs).forEach(API => { }) }) - describe.skip('access controls', () => { + describe('access controls', () => { it('granting access enables to write to the database', async () => { let err try { diff --git a/test/multiple-databases.test.js b/test/multiple-databases.test.js index d01f63e..d190e29 100644 --- a/test/multiple-databases.test.js +++ b/test/multiple-databases.test.js @@ -133,7 +133,7 @@ Object.keys(testAPIs).forEach(API => { await db.drop() }) - it.skip('replicates multiple open databases', async () => { + it('replicates multiple open databases', async () => { const entryCount = 32 const entryArr = [] diff --git a/test/replicate-and-load.test.js b/test/replicate-and-load.test.js index f3a5140..931c9ae 100644 --- a/test/replicate-and-load.test.js +++ b/test/replicate-and-load.test.js @@ -96,7 +96,7 @@ Object.keys(testAPIs).forEach(API => { } }) - it.skip('replicates database of 100 entries and loads it from the disk', async () => { + it('replicates database of 100 entries and loads it from the disk', async () => { const entryCount = 100 const entryArr = [] let timer diff --git a/test/replicate.test.js b/test/replicate.test.js index eb7e278..2e40895 100644 --- a/test/replicate.test.js +++ b/test/replicate.test.js @@ -20,7 +20,7 @@ const dbPath2 = './orbitdb/tests/replication/2/db2' Object.keys(testAPIs).forEach(API => { describe(`orbit-db - Replication (${API})`, function() { - this.timeout(5000) + this.timeout(config.timeout * 2) let ipfsd1, ipfsd2, ipfs1, ipfs2 let orbitdb1, orbitdb2, db1, db2 @@ -124,7 +124,7 @@ Object.keys(testAPIs).forEach(API => { }) }) - it.skip('replicates database of 100 entries', async () => { + it('replicates database of 100 entries', async () => { console.log("Waiting for peers to connect") await waitForPeers(ipfs2, [orbitdb1.id], db1.address.toString()) @@ -139,17 +139,11 @@ Object.keys(testAPIs).forEach(API => { entryArr.push(i) return new Promise(async (resolve, reject) => { - let c = 0 - db2.events.on('replicate', (address, entry) => { - c ++ - }) db2.events.on('replicated', () => { // Once db2 has finished replication, make sure it has all elements // and process to the asserts below - const items = db2.iterator({ limit: -1 }).collect() - const all = items.length + const all = db2.iterator({ limit: -1 }).collect().length finished = (all === entryCount) - console.log(">>", finished, all, entryCount, c) }) try { @@ -172,7 +166,7 @@ Object.keys(testAPIs).forEach(API => { }) }) - it.skip('emits correct replication info', async () => { + it('emits correct replication info', async () => { console.log("Waiting for peers to connect") await waitForPeers(ipfs2, [orbitdb1.id], db1.address.toString()) @@ -246,7 +240,7 @@ Object.keys(testAPIs).forEach(API => { }) }) - it.skip('emits correct replication info on fresh replication', async () => { + it('emits correct replication info on fresh replication', async () => { return new Promise(async (resolve, reject) => { let finished = false const entryCount = 512 @@ -334,7 +328,7 @@ Object.keys(testAPIs).forEach(API => { }) }) - it.skip('emits correct replication info in two-way replication', async () => { + it('emits correct replication info in two-way replication', async () => { return new Promise(async (resolve, reject) => { console.log("Waiting for peers to connect") await waitForPeers(ipfs2, [orbitdb1.id], db1.address.toString())