summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGireesh Punathil <gpunathi@in.ibm.com>2019-01-09 09:06:15 -0500
committerGireesh Punathil <gpunathi@in.ibm.com>2019-01-20 18:14:01 +0530
commitcc26957cc30d89619d3b9be85f5301111e17615a (patch)
treec8b62a28f40d4d5dacf6f97ac1611d10e4b77743 /test
parentc1ac57888199ba13df7eda4912cdb53dcfb5a2ee (diff)
downloadandroid-node-v8-cc26957cc30d89619d3b9be85f5301111e17615a.tar.gz
android-node-v8-cc26957cc30d89619d3b9be85f5301111e17615a.tar.bz2
android-node-v8-cc26957cc30d89619d3b9be85f5301111e17615a.zip
test: relax chunk count expectations
In parallel/test-fs-read-stream-concurrent-reads.js the number of data chunks used is being tested when few concurrent reads are performed. The number of chunks can fluctuate based on the number of concurrent reads as well as the data that was read in one shot. Accommodate these variations in the test. Fixes: https://github.com/nodejs/node/issues/22339 PR-URL: https://github.com/nodejs/node/pull/25415 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-fs-read-stream-concurrent-reads.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/parallel/test-fs-read-stream-concurrent-reads.js b/test/parallel/test-fs-read-stream-concurrent-reads.js
index 32a6cd6236..b567448486 100644
--- a/test/parallel/test-fs-read-stream-concurrent-reads.js
+++ b/test/parallel/test-fs-read-stream-concurrent-reads.js
@@ -13,7 +13,7 @@ const fs = require('fs');
const filename = fixtures.path('loop.js'); // Some small non-homogeneous file.
const content = fs.readFileSync(filename);
-const N = 1000;
+const N = 2000;
let started = 0;
let done = 0;
@@ -26,10 +26,10 @@ function startRead() {
.on('data', (chunk) => {
chunks.push(chunk);
arrayBuffers.add(chunk.buffer);
- if (started < N)
- startRead();
})
.on('end', common.mustCall(() => {
+ if (started < N)
+ startRead();
assert.deepStrictEqual(Buffer.concat(chunks), content);
if (++done === N) {
const retainedMemory =
@@ -43,5 +43,5 @@ function startRead() {
// Don’t start the reads all at once – that way we would have to allocate
// a large amount of memory upfront.
-for (let i = 0; i < 4; ++i)
+for (let i = 0; i < 6; ++i)
startRead();