Skip to content

Commit 0c72e08

Browse files
authored
test: increase timeout on child retain tests (#293)
1 parent 50a87fc commit 0c72e08

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.github/workflows/coverage.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ jobs:
2828
node-version: ${{ matrix.node-version }}
2929
- run: yarn install --frozen-lockfile --non-interactive
3030
- run: yarn coverage
31-
- run: yarn coveralls
31+
- name: Coverage
32+
env:
33+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
34+
run: yarn coveralls

src/test/test_child-pool.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('Child pool', () => {
6565
expect(children).to.have.length(6);
6666
const child = await pool.retain(processor);
6767
expect(children).not.to.include(child);
68-
});
68+
}).timeout(10000);
6969

7070
it('should return an old child if many retained and one free', async () => {
7171
const processor = __dirname + '/fixtures/fixture_processor_bar.js';
@@ -82,5 +82,5 @@ describe('Child pool', () => {
8282
pool.release(children[0]);
8383
const child = await pool.retain(processor);
8484
expect(children).to.include(child);
85-
});
85+
}).timeout(10000);
8686
});

src/test/test_rate_limiter.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,16 @@ describe('Rate Limiter', function() {
136136
const afterJobs = after(numJobs, () => {
137137
try {
138138
const timeDiff = Date.now() - startTime;
139-
expect(timeDiff).to.be.gte(numGroups * 1000);
139+
// In some test envs, these timestamps can drift.
140+
expect(timeDiff).to.be.gte(numGroups * 990);
140141
expect(timeDiff).to.be.below((numGroups + 1) * 1100);
141142

142143
for (const group in completed) {
143144
let prevTime = completed[group][0];
144145
for (let i = 1; i < completed[group].length; i++) {
145146
const diff = completed[group][i] - prevTime;
146147
expect(diff).to.be.below(2000);
147-
expect(diff).to.be.gte(1000);
148+
expect(diff).to.be.gte(990);
148149
prevTime = completed[group][i];
149150
}
150151
}

0 commit comments

Comments
 (0)