Skip to content

Commit

Permalink
test: speed up core manager unreplicate tests
Browse files Browse the repository at this point in the history
On my machine, this cuts the time from ~12 seconds to ~1 second.
  • Loading branch information
EvanHahn committed Aug 28, 2024
1 parent 519169d commit 73203f0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/core-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,9 @@ test('sends "haves" bitfields over project creator core replication stream', asy
await Promise.all([once(n1, 'close'), once(n2, 'close')])
})

test('unreplicate', async (t) => {
test('unreplicate', { concurrency: true }, async (t) => {
/** @type {Promise<unknown>[]} */ const testPromises = []

const WAIT_TIMEOUT = 200
const REPLICATION_DELAY = 20
const scenarios = [
Expand Down Expand Up @@ -440,7 +442,7 @@ test('unreplicate', async (t) => {

for (const unreplicateWait of [0, 100]) {
for (const scenario of scenarios) {
await t.test(
const testPromise = t.test(
`unreplicate: ${scenario.unreplicate.join(
', '
)}; rereplicate: ${scenario.rereplicate.join(
Expand Down Expand Up @@ -512,8 +514,11 @@ test('unreplicate', async (t) => {
}
}
)
testPromises.push(testPromise)
}
}

await Promise.all(testPromises)
})

test('deleteOthersData()', async (t) => {
Expand Down

0 comments on commit 73203f0

Please sign in to comment.