-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
During a refactoring of our internal fork of this repo, we recently discovered the test util function doesNotBecomeCircular (linked below).
serverless-plugin-split-stacks/__tests__/migration-strategy/per-group-function.js
Lines 16 to 33 in 8164136
| const doesNotBecomeCircular = function (resources) { | |
| const memo = {}; | |
| Object.keys(resources).forEach(resourceName => { | |
| const resource = resources[resourceName]; | |
| if (resource.DependsOn) { | |
| resource.DependsOn.forEach(parent => { | |
| if (!memo[parent]) { | |
| memo[parent] = [resourceName]; | |
| } else { | |
| memo[parent].push(resourceName); | |
| } | |
| }); | |
| } | |
| }); | |
| return Object.keys(memo).every(parentName => memo[parentName].length <= 1); | |
| }; |
We think this is a good starting point to detect potential errors before we wait for the long-running deployment process in CloudFormation, the situation gets significant for projects with more than 300 functions like ours. We have to wait for more than 1 hour just to discover this error.
This should also improve the situation in #20 #53 #83 #102 #105 #116 #122
@dougmoscrop Do you think this function is good enough as a pre-deployment assertion?
MaksymLogvyniuk and BubexBubex
Metadata
Metadata
Assignees
Labels
No labels