mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
Integration tests that covers integration lambda timeout
This commit is contained in:
parent
5282cab708
commit
a4f851db57
@ -43,9 +43,20 @@ async function apiKeys(event) {
|
||||
};
|
||||
}
|
||||
|
||||
async function timeout(event) {
|
||||
return new Promise(resolve => setTimeout(() => resolve({
|
||||
statusCode: 200,
|
||||
body: JSON.stringify({
|
||||
message: 'Should not happen (timeout expected)',
|
||||
event,
|
||||
}),
|
||||
}), 2000));
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
minimal,
|
||||
cors,
|
||||
customAuthorizers,
|
||||
apiKeys,
|
||||
timeout,
|
||||
};
|
||||
|
||||
@ -57,6 +57,14 @@ functions:
|
||||
path: api-keys
|
||||
method: GET
|
||||
private: true
|
||||
timeout:
|
||||
handler: core.timeout
|
||||
timeout: 1
|
||||
events:
|
||||
- http:
|
||||
method: GET
|
||||
integration: lambda
|
||||
path: integration-lambda-timeout
|
||||
# helper functions
|
||||
authorizer:
|
||||
handler: helper.auth
|
||||
|
||||
@ -264,4 +264,10 @@ describe('AWS - API Gateway Integration Test', () => {
|
||||
.then((json) => expect(json.message).to.equal('Hello from API Gateway! - (minimal)'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('Integration Lambda Timeout', () => {
|
||||
it('should result with 504 status code',
|
||||
() => fetch(`${endpoint}/integration-lambda-timeout`)
|
||||
.then(response => expect(response.status).to.equal(504)));
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user