Skip to content

Commit 842201c

Browse files
authoredMar 10, 2025··
fix(efs): cannot run an integ test when transitionToArchivePolicy is specified and throughputMode is undefined (#33713)
### Issue # (if applicable) N/A ### Reason for this change I encountered this problem when fixing a bug. This PR fixes an issue where we cannot rerun [test/aws-efs/test/integ.efs-transition.js](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-transition.ts). When attempting to rerun this test, the following error is encountered: ```sh The ThroughputMode value for the file system does not support TransitionToArchive. Either change the ThroughputMode value to Elastic or remove the TransitionToArchive parameter. ``` When `throughputMode` is `undefined`, throughput mode is set to `Bursting`. However, `transitionToArchive` is only supported in the Elastic throughput mode. ([Ref](https://docs.aws.amazon.com/efs/latest/ug/API_PutLifecycleConfiguration.html)) > The Archive storage class is available only for file systems that use the Elastic throughput mode and the General Purpose performance mode. ### Description of changes Set `throughputMode` to `Elastic` when `transitionToArchivePolicy` is specified in a unit test and an integ test. I also considered adding validations. However, I decided against it as it might cause regression issues. ### Describe any new or updated permissions being added Nothing ### Description of how you validated changes Successfully reran the integration test. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 25619a0 commit 842201c

File tree

9 files changed

+322
-58
lines changed

9 files changed

+322
-58
lines changed
 

‎packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-transition.js.snapshot/cdk.out

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-transition.js.snapshot/integ.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-transition.js.snapshot/manifest.json

+152-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-transition.js.snapshot/test-efs-transition-integ.assets.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-transition.js.snapshot/test-efs-transition-integ.template.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,8 @@
395395
{
396396
"TransitionToArchive": "AFTER_90_DAYS"
397397
}
398-
]
398+
],
399+
"ThroughputMode": "elastic"
399400
},
400401
"UpdateReplacePolicy": "Retain",
401402
"DeletionPolicy": "Retain"

‎packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-transition.js.snapshot/testefsintegtestDefaultTestDeployAssert7E1529D5.assets.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-transition.js.snapshot/tree.json

+158-48
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-transition.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as ec2 from 'aws-cdk-lib/aws-ec2';
22
import * as cdk from 'aws-cdk-lib';
3-
import { FileSystem, LifecyclePolicy, OutOfInfrequentAccessPolicy } from 'aws-cdk-lib/aws-efs';
3+
import { FileSystem, LifecyclePolicy, OutOfInfrequentAccessPolicy, ThroughputMode } from 'aws-cdk-lib/aws-efs';
44
import * as integ from '@aws-cdk/integ-tests-alpha';
55

66
const app = new cdk.App();
@@ -11,6 +11,7 @@ const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 3, natGateways: 1, restrictDefau
1111
new FileSystem(stack, 'FileSystem', {
1212
vpc,
1313
lifecyclePolicy: LifecyclePolicy.AFTER_14_DAYS,
14+
throughputMode: ThroughputMode.ELASTIC,
1415
transitionToArchivePolicy: LifecyclePolicy.AFTER_90_DAYS,
1516
outOfInfrequentAccessPolicy: OutOfInfrequentAccessPolicy.AFTER_1_ACCESS,
1617
});

‎packages/aws-cdk-lib/aws-efs/test/efs-file-system.test.ts

+2
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,14 @@ test('file system LifecyclePolicies is created correctly', () => {
113113
// WHEN
114114
new FileSystem(stack, 'EfsFileSystem', {
115115
vpc,
116+
throughputMode: ThroughputMode.ELASTIC,
116117
lifecyclePolicy: LifecyclePolicy.AFTER_7_DAYS,
117118
outOfInfrequentAccessPolicy: OutOfInfrequentAccessPolicy.AFTER_1_ACCESS,
118119
transitionToArchivePolicy: LifecyclePolicy.AFTER_14_DAYS,
119120
});
120121
// THEN
121122
Template.fromStack(stack).hasResourceProperties('AWS::EFS::FileSystem', {
123+
ThroughputMode: 'elastic',
122124
LifecyclePolicies: [
123125
{
124126
TransitionToIA: 'AFTER_7_DAYS',

0 commit comments

Comments
 (0)
Please sign in to comment.