From 3c7767cc00deb7739198ebbcf996a444cbee91bc Mon Sep 17 00:00:00 2001 From: HDegroote <75906619+HDegroote@users.noreply.github.com> Date: Tue, 3 Jun 2025 14:27:42 +0200 Subject: [PATCH] Fix race condition in tests using replication --- package.json | 2 +- test.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ce346ad..798ac1c 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "dependencies": { "hyperbee": "^2.11.1", "hyperblobs": "^2.3.0", - "hypercore": "^11.0.0", + "hypercore": "holepunchto/hypercore#update-min-length", "hypercore-errors": "^1.0.0", "is-options": "^1.0.2", "mirror-drive": "^1.2.0", diff --git a/test.js b/test.js index 70921d0..44c1bcf 100644 --- a/test.js +++ b/test.js @@ -1304,6 +1304,7 @@ test('drive.entry(key, { timeout })', async (t) => { await replicate(drive, swarm, mirror) await drive.put('/file.txt', b4a.from('hi')) + await mirror.drive.db.core.update({ length: 2 }) await mirror.drive.getBlobs() await swarm.destroy() @@ -1324,6 +1325,7 @@ test('drive.entry(key, { wait })', async (t) => { await replicate(drive, swarm, mirror) await drive.put('/file.txt', b4a.from('hi')) + await mirror.drive.db.core.update({ length: 2 }) await mirror.drive.getBlobs() await swarm.destroy() @@ -1344,6 +1346,7 @@ test('drive.get(key, { timeout })', async (t) => { await replicate(drive, swarm, mirror) await drive.put('/file.txt', b4a.from('hi')) + await mirror.drive.db.core.update({ length: 2 }) await mirror.drive.getBlobs() const entry = await mirror.drive.entry('/file.txt') @@ -1368,6 +1371,7 @@ test('drive.get(key, { wait }) with entry but no blob', async (t) => { await replicate(drive, swarm, mirror) await drive.put('/file.txt', b4a.from('hi')) + await mirror.drive.db.core.update({ length: 2 }) await mirror.drive.getBlobs() const entry = await mirror.drive.entry('/file.txt') @@ -1392,6 +1396,7 @@ test('drive.get(key, { wait }) without entry', async (t) => { await replicate(drive, swarm, mirror) await drive.put('/file.txt', b4a.from('hi')) + await mirror.drive.db.core.update({ length: 2 }) await mirror.drive.getBlobs() await swarm.destroy() @@ -1412,6 +1417,7 @@ test('drive peek with get() and timeout', async (t) => { await replicate(drive, swarm, mirror) await drive.put('/file.txt', b4a.from('hi')) + await mirror.drive.db.core.update({ length: 2 }) await mirror.drive.getBlobs() const entry = await mirror.drive.entry('/file.txt')