Skip to content

Commit

Permalink
fix: docs and unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mazyu36 committed May 11, 2024
1 parent a48bc2d commit ec3ebd4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 27 deletions.
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-docdb/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export interface DatabaseClusterProps {
/**
* Whether to copy tags to the snapshot when a snapshot is created.
*
* @default - not copy tags to the snapshot
* @default - false
*/
readonly copyTagsToSnapshot?: boolean;
}
Expand Down
29 changes: 3 additions & 26 deletions packages/aws-cdk-lib/aws-docdb/test/cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1136,30 +1136,7 @@ describe('DatabaseCluster', () => {
});
});

test('cluster with copyTagsToSnapshot disabled', () => {
// GIVEN
const stack = testStack();
const vpc = new ec2.Vpc(stack, 'VPC');

// WHEN
new DatabaseCluster(stack, 'Database', {
masterUser: {
username: 'admin',
password: cdk.SecretValue.unsafePlainText('tooshort'),
},
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL),
vpc,
copyTagsToSnapshot: false,
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', {
CopyTagsToSnapshot: false,
});
});

test('cluster with copyTagsToSnapshot enabled', () => {
// GIVEN
test.each([false, true])('cluster with copyTagsToSnapshot set', (value) => {
const stack = testStack();
const vpc = new ec2.Vpc(stack, 'VPC');

Expand All @@ -1171,12 +1148,12 @@ describe('DatabaseCluster', () => {
},
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL),
vpc,
copyTagsToSnapshot: true,
copyTagsToSnapshot: value,
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', {
CopyTagsToSnapshot: true,
CopyTagsToSnapshot: value,
});
});
});
Expand Down

0 comments on commit ec3ebd4

Please sign in to comment.