Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(integ-runner-alpha): (Support setting custom test timeout) #24137

Open
2 tasks
grsubramanian opened this issue Feb 13, 2023 · 4 comments
Open
2 tasks

(integ-runner-alpha): (Support setting custom test timeout) #24137

grsubramanian opened this issue Feb 13, 2023 · 4 comments
Labels
@aws-cdk/aws-lambda Related to AWS Lambda cli Issues related to the CDK CLI effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Comments

@grsubramanian
Copy link

Describe the feature

Currently, the custom resource Lambda function that does assertions has a default timeout of 2 mins. Further, there does not seem to be a way to specify a higher timeout. This functionality would be really useful in leveraging the full 15 min timeout of Lambda functions.

Use Case

We have some tests that we'd like to run using CDK integ-runner, but the tests need more than 2 mins.

Proposed Solution

Support some option named timeout or such as shown below.

Option #1

test.assertions
    .invokeFunction({
        functionName: functionName,
        timeout: <some object of type Duration>
    })
    .expect(
        ExpectedResult.objectLike({
            StatusCode: 200,
            Payload: "null",
        })
    );

Option #2

const test = new IntegTest(app, "TestName", {
    testCases: [stackUnderTest], 
    timeout: <some object of type Duration>
});

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

^2.63.2

Environment details (OS name and version, etc.)

MacOS Monterey 12.5 (irrelevant to current issue)

@grsubramanian grsubramanian added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Feb 13, 2023
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label Feb 13, 2023
@peterwoodworth peterwoodworth added p2 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Feb 13, 2023
@peterwoodworth
Copy link
Contributor

This currently seems to be hardcoded here, thanks for the request

Timeout: Duration.minutes(2).toSeconds(),

Until we provide a direct way to modify this, you could use escape hatches to modify the template.

I am marking this issue as p2, which means that we are unable to work on this immediately.

We use +1s to help prioritize our work, and are happy to revaluate this issue based on community feedback. You can reach out to the cdk.dev community on Slack to solicit support for reprioritization.

@grsubramanian
Copy link
Author

For the record, could you provide an example snippet that shows how to apply the escape hatch for this scenario? Thanks.

@peterwoodworth
Copy link
Contributor

Sure, here's an example. It will be inaccurate if you pass in an assertionStack to IntegTest, if that is the case you must work based off that stack

    this.integtest = new integ.IntegTest(this, 'IntegTest', {
      testCases: props.stacks,
    });

    this.integtest.assertions.awsApiCall('s3', 'getbucket');

    const fn = this.integtest
      .node.findChild('DefaultTest') // Consistent
      .node.findChild('DeployAssert') // Consistent
      .node.findChild('SingletonFunction1488541a7b23466481b69b4408076b81') // ID may differ here, check your template or use an alternate method of specifying child (e.g. .children[1])
      .node.findChild('Handler') as CfnResource; // Consistent

    fn.addPropertyOverride('Timeout', 600); // Override

@grsubramanian
Copy link
Author

That got me a bit further, but now I get another error in the Lambda invoke. The occurrence of 120000ms in the error tells me there is some other deeper connection to the timeout of 2 mins. Maybe there is something else that needs to be overriden through the escape hatch mechanism?

Received response status [FAILED] from custom resource. Message returned: Connection timed out after 120000ms (RequestId: <some request ID>)

@pahud pahud added the cli Issues related to the CDK CLI label Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda Related to AWS Lambda cli Issues related to the CDK CLI effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

3 participants