Fix replication issues

This commit is contained in:
haad 2022-12-30 14:40:37 +02:00
parent cd9b3bfa02
commit e6e3bcc994
7 changed files with 15 additions and 21 deletions

8
package-lock.json generated
View File

@ -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",

View File

@ -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"

View File

@ -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 {

View File

@ -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 {

View File

@ -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 = []

View File

@ -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

View File

@ -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())