Skip to content

Commit

Permalink
test: unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
badmintoncryer committed Dec 27, 2023
1 parent ee95f04 commit 4ac87bc
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/aws-cdk-lib/aws-efs/test/efs-file-system.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -874,4 +874,32 @@ test('anonymous access is prohibited by the @aws-cdk/aws-efs:denyAnonymousAccess
],
},
});
});

test('specify availabilityZoneName to create mount targets in a specific AZ', () => {
// WHEN
new FileSystem(stack, 'EfsFileSystem', {
vpc,
availabilityZoneName: 'us-east-1a',
});

// THEN
console.log(JSON.stringify(Template.fromStack(stack).toJSON()));
Template.fromStack(stack).hasResourceProperties('AWS::EFS::FileSystem', {
AvailabilityZoneName: 'us-east-1a',
});
// mount target should be created only 1
Template.fromStack(stack).resourceCountIs('AWS::EFS::MountTarget', 1);
Template.fromStack(stack).hasResourceProperties('AWS::EFS::MountTarget', {
AvailabilityZoneId: {
'Fn::Select': [
0,
{
'Fn::GetAZs': {
Ref: 'AWS::Region',
},
},
],
},
});
});

0 comments on commit 4ac87bc

Please sign in to comment.