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
Retain console properties on function deploy #11849
Retain console properties on function deploy #11849
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #11849 +/- ##
==========================================
+ Coverage 85.97% 86.64% +0.66%
==========================================
Files 316 316
Lines 13377 13401 +24
==========================================
+ Hits 11501 11611 +110
+ Misses 1876 1790 -86
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Danwakeem for taking care of that.
It'll be great to also have that covered with unit tests (setup with runServerless
) that test scenario where layers are configured remotely and (1) not configured explicitly in service config (2) configured explicitly in service config
@medikoo I noticed that the I feels like there is a lot going on in the |
@Danwakeem ideally this should be handled as other tests that are configured with What you need to here is believe introduce some extra representations of lambda configurations to be returned by serverless/test/unit/lib/plugins/aws/deploy-function.test.js Lines 326 to 332 in 77c91f2
Into dynamic resolution as follows: getFunction: (params) {
if (params.FunctionName === 'console') {
// return configuration with layers
} else {
return {
LastModified: '2020-05-20T15:34:16.494+0000',
State: 'Active',
LastUpdateStatus: 'Successful',
};
}
} And then in your test cases when you want to test against functions with layers you just pick name which will return you configurations with layers |
@medikoo But isn't the function this code is written in stubbed in those same tests? So
If this is the case, it might make sense to just extract the two logic blocks where we merge layers and environment variables into small functions so we can test those bits of logic individually. I was thinking this could make this block of code a bit more readable and easier to test. |
In test I believe you need to confirm that this stub was triggered with expected layers set and environment variables |
2e0cbe3
to
7b123e8
Compare
Thanks @medikoo. After poking around with the tests for a bit I see how these fit together. I ended up adding the tests you had suggested and some more fine grain tests on merging environment and layer properties. Let me know what you think about the tests I added in the most recent commit 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Danwakeem. It looks very promising. We're getting close 👍
@medikoo Thanks for pointing out that I could convert the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Danwakeem ! I have just a few final suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Danwakeem, we're close!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 👍 🎉
Thanks again @medikoo 🎸 lol I think with all the help you have offered me I owe you a beer or something 🍻 |
Description
Fixed an issue when deploying a single function that has been instrumented by serverless console.
Should retain environment variables and layers externally added by serverless console 👍