test(AWS Cognito): Decrease intensity of requests

This commit is contained in:
Mariusz Nowak 2020-08-28 22:19:38 +02:00
parent 207165796a
commit c45be699f7
No known key found for this signature in database
GPG Key ID: A292FE0143B1828B

View File

@ -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