Skip to content

Commit

Permalink
fix(docdb): autoMinorVersionUpgrade property was not set to true
Browse files Browse the repository at this point in the history
…by default as stated in the docstring (#9505)

Fixes #9494

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
ddneilson authored Aug 9, 2020
1 parent 9ff55ae commit e878f9c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-docdb/lib/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export class DatabaseInstance extends DatabaseInstanceBase implements IDatabaseI
const instance = new CfnDBInstance(this, 'Resource', {
dbClusterIdentifier: props.cluster.clusterIdentifier,
dbInstanceClass: `db.${props.instanceClass}`,
autoMinorVersionUpgrade: props.autoMinorVersionUpgrade,
autoMinorVersionUpgrade: props.autoMinorVersionUpgrade ?? true,
availabilityZone: props.availabilityZone,
dbInstanceIdentifier: props.dbInstanceName,
preferredMaintenanceWindow: props.preferredMaintenanceWindow,
Expand Down
28 changes: 28 additions & 0 deletions packages/@aws-cdk/aws-docdb/test/instance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,34 @@ describe('DatabaseInstance', () => {
Properties: {
DBClusterIdentifier: { Ref: 'DatabaseB269D8BB' },
DBInstanceClass: EXPECTED_SYNTH_INSTANCE_TYPE,
AutoMinorVersionUpgrade: true,
},
DeletionPolicy: 'Retain',
UpdateReplacePolicy: 'Retain',
}, ResourcePart.CompleteDefinition));
});

test.each([
[undefined, true],
[true, true],
[false, false],
])('check that autoMinorVersionUpdate works: %p', (given: boolean | undefined, expected: boolean) => {
// GIVEN
const stack = testStack();

// WHEN
new DatabaseInstance(stack, 'Instance', {
cluster: stack.cluster,
instanceClass: SINGLE_INSTANCE_TYPE,
autoMinorVersionUpgrade: given,
});

// THEN
expectCDK(stack).to(haveResource('AWS::DocDB::DBInstance', {
Properties: {
DBClusterIdentifier: { Ref: 'DatabaseB269D8BB' },
DBInstanceClass: EXPECTED_SYNTH_INSTANCE_TYPE,
AutoMinorVersionUpgrade: expected,
},
DeletionPolicy: 'Retain',
UpdateReplacePolicy: 'Retain',
Expand Down

0 comments on commit e878f9c

Please sign in to comment.