Repository navigation
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8212 +/- ##
==========================================
- Coverage 88.16% 88.03% -0.13%
==========================================
Files 248 248
Lines 9430 9320 -110
==========================================
- Hits 8314 8205 -109
+ Misses 1116 1115 -1
Continue to review full report at Codecov.
|
medikoo
left a comment
There was a problem hiding this comment.
Thank you @thewizarodofoz ! That looks very promising. Please see my remarks
| const functionWideProperties = ['ReservedConcurrentExecutions', 'Tags']; | ||
| const properties = _.omit( | ||
| _.get(functionResource, 'Properties', {}), | ||
| 'Code', | ||
| ...functionWideProperties | ||
| ); |
There was a problem hiding this comment.
What's the added value of creating functionWideProperties variable.
Isn't it simpler to just do _.omit(..., ['Code', 'ReservedConcurrentExecutions', 'Tags'] ?
There was a problem hiding this comment.
I thought it would make it more clear as to why these fields are omitted
There was a problem hiding this comment.
@thewizarodofoz that's a good point , but it'll probably be fine to solve it with simple inline code comment:
_.omit(..., [
'Code',
// Properties applied to function globally (not specific to version or alias)
'ReservedConcurrentExecutions', 'Tags'
])| }); | ||
| }); | ||
|
|
||
| it('should not create a new version object if only function-wide configuration changed', () => { |
There was a problem hiding this comment.
All new tests should be written with help of runServerless util (see https://github.com/serverless/serverless/blob/master/test/README.md)
In this case I would rely on basic function fixture as follows
- Setup a fixture with
fixture.setup, as e.g. it's done here: - Issue first
runServerlessand read all generated lambda version ids - Modify
reservedConcurrencyandtagswith help ofupdateConfig(returned byfixture.setup()) as it's done here:serverless/test/integration/apiGateway.test.js
Lines 191 to 204 in d9b91e9
- Re-run
runServerless, and confirm that version id didn't change
There was a problem hiding this comment.
Thanks @medikoo I refactored the test, but it seems to me the second call to runServerless isn't reading the updated config. I debugged the test and I did see updateConfig updating the serverless.yml in the temp dir, but as you can see in this assertion (which fails), runServerless isn't picking up those changes.
medikoo
left a comment
There was a problem hiding this comment.
runServerlessisn't picking up those changes.
Thanks for pointing. Indeed there was an issue in memoization setup, due to which, in same process second serverless instance of same service was relying on previously resolved config. I've fixed that in #8231
Update with master and issue should be gone
| _.get(functionResource, 'Properties', {}), | ||
| 'Code', | ||
| // Properties applied to function globally (not specific to version or alias) | ||
| // https://github.com/serverless/serverless/issues/7822 |
There was a problem hiding this comment.
I think we can remove the link to github issue.
If needed, it's easy to map given code lines to source PR and issue, by GitHub blame feature
…ide-properties-in-version-hash
medikoo
left a comment
There was a problem hiding this comment.
@thewizarodofoz that looks great! Thank you
I have just one final remark. Last week we've released v2 and dropped support for Node.js v6, which means we can freely now use async/await syntax, and ideally (for better maintenance) if all new code is introduced in that style.
Can you update the fixture so it's configured with async function and await keywords?
Sorry for late notice
| it('should not create a new version object if only function-wide configuration changed', () => { | ||
| return fixtures.setup('function').then(({ servicePath, updateConfig }) => |
There was a problem hiding this comment.
Can we upgrade this to async/await syntax?
There was a problem hiding this comment.
I was really hoping to do that! Yay!
|
@thewizarodofoz is this ready for re-review? If so, please re-request review in Reviewers box |
medikoo
left a comment
There was a problem hiding this comment.
Thank you @thewizarodofoz, It's all great, aside of that we should not commit describe.only.
Can you update it?
| }); | ||
| }); | ||
|
|
||
| describe.only('function config', () => { |
There was a problem hiding this comment.
.only I believe was committed in by accident
medikoo
left a comment
There was a problem hiding this comment.
Thank you @thewizarodofoz !
|
This PR has not resolved the issue. I am still getting |
|
@azizur see: #7822 (comment) |
Closes: #7822