Skip to content

Commit

Permalink
update integ tests and add count
Browse files Browse the repository at this point in the history
  • Loading branch information
Michelle Wang committed Sep 20, 2024
1 parent 1638d6f commit 2ae6eb7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 15 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@
],
"CreationPolicy": {
"ResourceSignal": {
"Count": 1,
"Timeout": "PT10M"
}
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions packages/aws-cdk-lib/aws-ec2/lib/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,6 @@ export class Instance extends Resource implements IInstance {
this.instancePublicDnsName = this.instance.attrPublicDnsName;
this.instancePublicIp = this.instance.attrPublicIp;

if (props.initOptions?.timeout && props.resourceSignalTimeout) {
Annotations.of(this).addWarningV2('@aws-cdk/aws-ec2:setSetimeout', 'Both initOptions.timeout and resourceSignalTimeout fields are set, timeout is summed together. It is suggested that only one of the two fields is set');
}

if (FeatureFlags.of(this).isEnabled(cxapi.EC2_SUM_TIMEOUT_ENABLED)) {
this.applyUpdatePolicies(props);

Expand Down Expand Up @@ -715,6 +711,7 @@ export class Instance extends Resource implements IInstance {
this.instance.cfnOptions.creationPolicy = {
...this.instance.cfnOptions.creationPolicy,
resourceSignal: {
...this.instance.cfnOptions.creationPolicy?.resourceSignal,
timeout: props.resourceSignalTimeout && props.resourceSignalTimeout.toIsoString(),
},
};
Expand Down
3 changes: 1 addition & 2 deletions packages/aws-cdk-lib/aws-ec2/test/instance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1089,10 +1089,10 @@ test('resourceSignalTimeout overwrites initOptions.timeout when feature flag tur
});

// THEN
Annotations.fromStack(stack).hasWarning('/Default/Instance', 'Both initOptions.timeout and resourceSignalTimeout fields are set, timeout is summed together. It is suggested that only one of the two fields is set [ack: @aws-cdk/aws-ec2:setSetimeout]');
Template.fromStack(stack).hasResource('AWS::EC2::Instance', {
CreationPolicy: {
ResourceSignal: {
Count: 1,
Timeout: 'PT10M',
},
},
Expand Down Expand Up @@ -1211,7 +1211,6 @@ test('resourceSignalTimeout and initOptions.timeout are both set, sum timeout an
});

// THEN
Annotations.fromStack(stack).hasWarning('/Default/Instance', 'Both initOptions.timeout and resourceSignalTimeout fields are set, timeout is summed together. It is suggested that only one of the two fields is set [ack: @aws-cdk/aws-ec2:setSetimeout]');
Template.fromStack(stack).hasResource('AWS::EC2::Instance', {
CreationPolicy: {
ResourceSignal: {
Expand Down

0 comments on commit 2ae6eb7

Please sign in to comment.