enum InvocationType
Language | Type name |
---|---|
.NET | Amazon.CDK.IntegTests.InvocationType |
Java | software.amazon.awscdk.integtests.InvocationType |
Python | aws_cdk.integ_tests.InvocationType |
TypeScript (source) | @aws-cdk/integ-tests » InvocationType |
The type of invocation.
Default is REQUEST_RESPONE
Example
declare const app: App;
declare const stack: Stack;
declare const queue: sqs.Queue;
declare const fn: lambda.IFunction;
const integ = new IntegTest(app, 'Integ', {
testCases: [stack],
});
integ.assertions.invokeFunction({
functionName: fn.functionName,
invocationType: InvocationType.EVENT,
payload: JSON.stringify({ status: 'OK' }),
});
const message = integ.assertions.awsApiCall('SQS', 'receiveMessage', {
QueueUrl: queue.queueUrl,
WaitTimeSeconds: 20,
});
message.assertAtPath('Messages.0.Body', ExpectedResult.objectLike({
requestContext: {
condition: 'Success',
},
requestPayload: {
status: 'OK',
},
responseContext: {
statusCode: 200,
},
responsePayload: 'success',
}));
Members
Name | Description |
---|---|
EVENT | Invoke the function asynchronously. |
REQUEST_RESPONE | Invoke the function synchronously. |
DRY_RUN | Validate parameter values and verify that the user or role has permission to invoke the function. |
EVENT
Invoke the function asynchronously.
Send events that fail multiple times to the function's dead-letter queue (if it's configured). The API response only includes a status code.
REQUEST_RESPONE
Invoke the function synchronously.
Keep the connection open until the function returns a response or times out. The API response includes the function response and additional data.
DRY_RUN
Validate parameter values and verify that the user or role has permission to invoke the function.