tests: Tune `waitForPromise()` poll count test some more

Looks like the test machines can be quite slow, which causes noise in
the count.
pull/4421/head
Richard Hansen 2020-10-14 11:54:39 -04:00 committed by John McLear
parent e0542f903a
commit 1dba121aff
1 changed files with 5 additions and 4 deletions

View File

@ -238,10 +238,11 @@ describe("the test helper", function(){
await helper.waitForPromise(() => { checks++; return false; }, 2000, 100)
.catch(() => { rejected = true; });
expect(rejected).to.be(true);
// One at the beginning, and 19-20 more depending on whether it's the timeout or the final
// poll that wins at 2000ms.
expect(checks).to.be.greaterThan(19);
expect(checks).to.be.lessThan(22);
// `checks` is expected to be 20 or 21: one at the beginning, plus 19 or 20 more depending on
// whether it's the timeout or the final poll that wins at 2000ms. Margin is added to reduce
// flakiness on slow test machines.
expect(checks).to.be.greaterThan(17);
expect(checks).to.be.lessThan(24);
});
});