Fix further flakiness in challenge tests on CI

This commit is contained in:
Fedor Indutny 2021-05-07 15:36:28 -07:00 committed by GitHub
parent d28678dbf9
commit a3693a7f4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -325,18 +325,18 @@ describe('ChallengeHandler', () => {
it('should not retry more than 5 times', async () => {
const handler = await createHandler();
const one = createMessage('1');
const one = createMessage('1', { retryAfter: IMMEDIATE_RETRY });
const retrySend = sinon.stub(one, 'retrySend');
messageStorage.set('1', one);
await handler.register(one);
const retrySend = sinon.stub(one, 'retrySend');
assert.isTrue(isInStorage(one.id));
assert.deepEqual(sent, []);
assert.equal(challengeStatus, 'required');
// Let it spam the server.
await sleep(DEFAULT_RETRY_AFTER + LEEWAY);
await sleep(LEEWAY);
assert.isTrue(isInStorage(one.id));
assert.deepEqual(sent, []);