From c45be699f71bdb8c44cbeb52d1bfca86ee81f113 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 28 Aug 2020 22:19:38 +0200 Subject: [PATCH] test(AWS Cognito): Decrease intensity of requests --- test/integration-all/cognito-user-pool/tests.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/integration-all/cognito-user-pool/tests.js b/test/integration-all/cognito-user-pool/tests.js index 1447ad5db..9840941e5 100644 --- a/test/integration-all/cognito-user-pool/tests.js +++ b/test/integration-all/cognito-user-pool/tests.js @@ -5,6 +5,7 @@ const BbPromise = require('bluebird'); const { expect } = require('chai'); const log = require('log').get('serverless:test'); const hasFailed = require('@serverless/test/has-failed'); +const wait = require('timers-ext/promise/sleep'); const { getTmpDirPath } = require('../../utils/fs'); const { @@ -20,6 +21,8 @@ const { const { createTestService, deployService, removeService } = require('../../utils/integration'); const { confirmCloudWatchLogs } = require('../../utils/misc'); +const waitASec = () => wait(1000); + describe('AWS - Cognito User Pool Integration Test', function() { this.timeout(1000 * 60 * 10); // Involves time-taking deploys let serviceName; @@ -87,7 +90,7 @@ describe('AWS - Cognito User Pool Integration Test', function() { await createUser(userPoolId, 'johndoe', '!!!wAsD123456wAsD!!!'); const events = await confirmCloudWatchLogs( `/aws/lambda/${stackName}-${functionName}`, - async () => {} + waitASec ); const logs = events.reduce((data, event) => data + event.message, ''); expect(logs).to.include(`"userPoolId":"${userPoolId}"`); @@ -105,7 +108,7 @@ describe('AWS - Cognito User Pool Integration Test', function() { await createUser(userPoolId, 'janedoe', '!!!wAsD123456wAsD!!!'); const events = await confirmCloudWatchLogs( `/aws/lambda/${stackName}-${functionName}`, - async () => {} + waitASec ); const logs = events.reduce((data, event) => data + event.message, ''); @@ -140,7 +143,7 @@ describe('AWS - Cognito User Pool Integration Test', function() { await initiateAuth(clientId, username, password); const events = await confirmCloudWatchLogs( `/aws/lambda/${stackName}-${functionName}`, - async () => {}, + waitASec, { checkIsComplete: soFarEvents => soFarEvents