From bb4e22ac838b60ca6d14d98a9f852bcde3e1a52f Mon Sep 17 00:00:00 2001 From: rafapaezbas Date: Thu, 30 Apr 2026 14:08:18 +0200 Subject: [PATCH 1/2] remote contiguousLength test --- test/replicate.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/replicate.js b/test/replicate.js index 9cdc933e..0b333ab1 100644 --- a/test/replicate.js +++ b/test/replicate.js @@ -2887,6 +2887,24 @@ test('backoff respected for NOT_AVAILABLE in case of incorrectly false remote bi t.ok(reader.replicator.stats.wireRequest.tx < 40, 'did not continue spamming (sanity check)') }) +test('remoteContiguousLength and remote contiguousLength match', async function (t) { + const a = await create(t) + + await a.append(['a', 'b', 'c']) + + const b = await create(t, a.key) + + let d = 0 + b.on('download', () => d++) + + replicate(a, b, t) + + await b.get(0) + await b.get(1) + + t.is(a.remoteContiguousLength, b.contiguousLength) +}) + async function createAndDownload(t, core) { const b = await create(t, core.key) replicate(core, b, t, { teardown: false }) From d16f6cac37707036bf07baa6bba096e4dcf57d24 Mon Sep 17 00:00:00 2001 From: rafapaezbas Date: Thu, 30 Apr 2026 15:56:00 +0200 Subject: [PATCH 2/2] updated test --- test/remote-length.js | 22 ++++++++++++++++++++++ test/replicate.js | 18 ------------------ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/test/remote-length.js b/test/remote-length.js index fc0db063..110f4b12 100644 --- a/test/remote-length.js +++ b/test/remote-length.js @@ -120,6 +120,28 @@ test('truncates by the writer result in the updated contiguous length being anno t.is(getPeer(b, a).remoteContiguousLength, 1, 'truncate broadcast to other peers') }) +test.solo('remoteContiguousLength and remote contiguousLength match', async function (t) { + const a = await create(t) + + await a.append(['a', 'b', 'c']) + + const b = await create(t, a.key) + + let d = 0 + b.on('download', () => d++) + + replicate(a, b, t) + + await b.get(0) + await b.get(1) + + while (b.contiguousLength !== a.remoteContiguousLength) { + await new Promise((resolve) => setTimeout(resolve, 20)) + } + + t.pass('contiguousLength matches remoteContiguousLength') +}) + // Get peer b as seen by peer a (b is the remote peer). function getPeer(a, b) { for (const aPeer of a.core.replicator.peers) { diff --git a/test/replicate.js b/test/replicate.js index 0b333ab1..9cdc933e 100644 --- a/test/replicate.js +++ b/test/replicate.js @@ -2887,24 +2887,6 @@ test('backoff respected for NOT_AVAILABLE in case of incorrectly false remote bi t.ok(reader.replicator.stats.wireRequest.tx < 40, 'did not continue spamming (sanity check)') }) -test('remoteContiguousLength and remote contiguousLength match', async function (t) { - const a = await create(t) - - await a.append(['a', 'b', 'c']) - - const b = await create(t, a.key) - - let d = 0 - b.on('download', () => d++) - - replicate(a, b, t) - - await b.get(0) - await b.get(1) - - t.is(a.remoteContiguousLength, b.contiguousLength) -}) - async function createAndDownload(t, core) { const b = await create(t, core.key) replicate(core, b, t, { teardown: false })