From 4ac87bc5604357802432cbb7c812c9354b608f09 Mon Sep 17 00:00:00 2001 From: Kazuho CryerShinozuka Date: Wed, 27 Dec 2023 13:46:45 +0900 Subject: [PATCH] test: unit test --- .../aws-efs/test/efs-file-system.test.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/packages/aws-cdk-lib/aws-efs/test/efs-file-system.test.ts b/packages/aws-cdk-lib/aws-efs/test/efs-file-system.test.ts index 0eef8d4de9192..e357e488fd7f1 100644 --- a/packages/aws-cdk-lib/aws-efs/test/efs-file-system.test.ts +++ b/packages/aws-cdk-lib/aws-efs/test/efs-file-system.test.ts @@ -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', + }, + }, + ], + }, + }); }); \ No newline at end of file