mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Make rate limiter tests more tolerant of slight timing variations.
This package contains some of the most fragile tests in the entire codebase, in large part because the author did not account for the nondeterminism of JS timers across platforms and test runs.
This commit is contained in:
@@ -95,7 +95,7 @@ testAsyncMulti("ddp rate limiter - callbacks get passed correct arguments", [
|
||||
Meteor.call(
|
||||
"getLastRateLimitEvent", expect(function (error, result) {
|
||||
test.isTrue(result.reply.allowed);
|
||||
test.isTrue(result.reply.timeToReset < RATE_LIMIT_INTERVAL_TIME_MS);
|
||||
test.isTrue(result.reply.timeToReset < RATE_LIMIT_INTERVAL_TIME_MS + 100);
|
||||
test.equal(result.reply.numInvocationsLeft, 4);
|
||||
|
||||
test.equal(result.ruleInput.userId, Meteor.userId());
|
||||
@@ -118,7 +118,7 @@ testAsyncMulti("ddp rate limiter - callbacks get passed correct arguments", [
|
||||
Meteor.call(
|
||||
"getLastRateLimitEvent", expect(function (error, result) {
|
||||
test.isFalse(result.reply.allowed);
|
||||
test.isTrue(result.reply.timeToReset < RATE_LIMIT_INTERVAL_TIME_MS);
|
||||
test.isTrue(result.reply.timeToReset < RATE_LIMIT_INTERVAL_TIME_MS + 100);
|
||||
test.equal(result.reply.numInvocationsLeft, 0);
|
||||
|
||||
test.equal(result.ruleInput.userId, Meteor.userId());
|
||||
|
||||
Reference in New Issue
Block a user