-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(lambda): erroneous inline code support for ruby #6365
Conversation
In the CHANGELOG this will read as:
Which might be interpreted as "there used to be no inline support for Ruby but we fixed that". I'd prefer a clearer phrasing. Maybe "Ruby erroneously advertises inline code support" |
@nija-at Can we add some kind of test? https://github.com/aws/aws-cdk/pull/6365/checks?check_run_id=455627583 I would imagine the following code should fail on instantiation, right? new lambda.Function(stack, 'foobar', {
code: new lambda.InlineCode('def handler(event:, context:) ; "success" ; end'),
handler: 'index.handler',
timeout: cdk.Duration.seconds(15),
runtime: lambda.Runtime.RUBY_2_5
}); |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Yes, this would previously fail on
There's no 'useful' test I can think of. Suggestions? |
I guess that depends where exactly the code will fail. But my suggestion is to add a validation in the if (props.code instanceof InlineCode && !props.runtime.supportsInlineCode) {
throw new ...
} And then simply add a test to test.function.ts. WDYT? |
@nija-at I guess an even simpler test would be:
That is assuming we have a test further down the line that validates we fail when defining inline code with an unsupported runtime. |
@iliapolo - sorry, but I don't find these to be useful tests. They are not testing any cyclomatic complexity, which is what unit tests should cover. The only valuable test would be an integration test that attempts to deploy a stack and checks that the deployment succeeds. Unfortunately, we don't have a mechanism in place to do this during PR or pipeline builds. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request is now being automatically merged. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request is now being automatically merged. |
Commit Message
fix(lambda): erroneous inline code support for ruby (#6365)
See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-zipfile
fixes #6302
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license