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
exclude tags and reservedConcurrency from version hash #8212
Changes from 2 commits
ecc172c
c1adb6a
8562f4f
19ab38c
6efc191
5f0b585
b424b3c
613e737
16be040
b8dee0e
39e31eb
e29da47
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2240,6 +2240,55 @@ describe('AwsCompileFunctions', () => { | |||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
it('should not create a new version object if only function-wide configuration changed', () => { | ||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All new tests should be written with help of In this case I would rely on basic
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @medikoo I refactored the test, but it seems to me the second call to |
||||||||||||||||||||||||||||||||
awsCompileFunctions.serverless.service.functions = { | ||||||||||||||||||||||||||||||||
func: { | ||||||||||||||||||||||||||||||||
handler: 'func.function.handler', | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
anotherFunc: { | ||||||||||||||||||||||||||||||||
handler: 'anotherFunc.function.handler', | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
const expectedOutputs = { | ||||||||||||||||||||||||||||||||
FuncLambdaFunctionQualifiedArn: { | ||||||||||||||||||||||||||||||||
Description: 'Current Lambda function version', | ||||||||||||||||||||||||||||||||
Value: { Ref: 'FuncLambdaVersionRk2uCHjn9BWyD0yH8GzU5kTmGVjCc6ZZx46sUUI1LQ' }, | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
AnotherFuncLambdaFunctionQualifiedArn: { | ||||||||||||||||||||||||||||||||
Description: 'Current Lambda function version', | ||||||||||||||||||||||||||||||||
Value: { | ||||||||||||||||||||||||||||||||
Ref: 'AnotherFuncLambdaVersionha2TZXucQgvNN4zjzNnEFIaTGAQxdp7jICMvFkl0', | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
return expect(awsCompileFunctions.compileFunctions()) | ||||||||||||||||||||||||||||||||
.to.be.fulfilled.then(() => { | ||||||||||||||||||||||||||||||||
expect( | ||||||||||||||||||||||||||||||||
awsCompileFunctions.serverless.service.provider.compiledCloudFormationTemplate.Outputs | ||||||||||||||||||||||||||||||||
).to.deep.equal(expectedOutputs); | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
// Change configuration | ||||||||||||||||||||||||||||||||
awsCompileFunctions.serverless.service.provider.compiledCloudFormationTemplate = { | ||||||||||||||||||||||||||||||||
Resources: {}, | ||||||||||||||||||||||||||||||||
Outputs: {}, | ||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
_.set(awsCompileFunctions, 'serverless.service.functions.func.tags', { MYTAG: 'mytag' }); | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
_.set(awsCompileFunctions, 'serverless.service.functions.func.reservedConcurrency', 1); | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
return expect(awsCompileFunctions.compileFunctions()).to.be.fulfilled; | ||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||
.then(() => { | ||||||||||||||||||||||||||||||||
// Expect same version hash | ||||||||||||||||||||||||||||||||
expect( | ||||||||||||||||||||||||||||||||
awsCompileFunctions.serverless.service.provider.compiledCloudFormationTemplate.Outputs | ||||||||||||||||||||||||||||||||
).to.deep.equal(expectedOutputs); | ||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
it('should include description under version too if function is specified', () => { | ||||||||||||||||||||||||||||||||
awsCompileFunctions.serverless.service.functions = { | ||||||||||||||||||||||||||||||||
func: { | ||||||||||||||||||||||||||||||||
|
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it would make it more clear as to why these fields are omitted
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.
@thewizarodofoz that's a good point , but it'll probably be fine to solve it with simple inline code comment: