Skip to content

Commit

Permalink
fix(cli): state machine hotswap fails if the DependsOn change (aws#…
Browse files Browse the repository at this point in the history
…22396)

----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
rix0rrr authored and madeline-k committed Oct 10, 2022
1 parent 0abdd1e commit c0bc1d4
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ async function isStateMachineDefinitionOnlyChange(
}

const propertyUpdates = change.propertyUpdates;
if (Object.keys(propertyUpdates).length === 0) {
return ChangeHotswapImpact.IRRELEVANT;
}

for (const updatedPropName in propertyUpdates) {
// ensure that only changes to the definition string result in a hotswap
if (updatedPropName !== 'DefinitionString') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,3 +637,40 @@ test('knows how to handle attributes of the AWS::DynamoDB::Table resource', asyn
}),
});
});

test('does not explode if the DependsOn changes', async () => {
// GIVEN
setup.setCurrentCfnStackTemplate({
Resources: {
Machine: {
Type: 'AWS::StepFunctions::StateMachine',
Properties: {
DefinitionString: '{ Prop: "old-value" }',
StateMachineName: 'my-machine',
},
DependsOn: ['abc'],
},
},
});
const cdkStackArtifact = setup.cdkStackArtifactOf({
template: {
Resources: {
Machine: {
Type: 'AWS::StepFunctions::StateMachine',
Properties: {
DefinitionString: '{ Prop: "old-value" }',
StateMachineName: 'my-machine',
},
},
DependsOn: ['xyz'],
},
},
});

// WHEN
const deployStackResult = await hotswapMockSdkProvider.tryHotswapDeployment(cdkStackArtifact);

// THEN
expect(deployStackResult).not.toBeUndefined();
expect(mockUpdateMachineDefinition).not.toHaveBeenCalled();
});

0 comments on commit c0bc1d4

Please sign in to comment.