Skip to content

Commit d7c4084

Browse files
committed
Add an acctest to increase IOPS and capacity at the same time
1 parent 6c96f6c commit d7c4084

File tree

1 file changed

+52
-8
lines changed

1 file changed

+52
-8
lines changed

internal/service/fsx/lustre_file_system_test.go

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ func TestAccFSxLustreFileSystem_metadataConfig(t *testing.T) {
10101010
ImportStateVerifyIgnore: []string{names.AttrSecurityGroupIDs},
10111011
},
10121012
{
1013-
Config: testAccLustreFileSystemConfig_metadata_iops(rName, "USER_PROVISIONED", 1500),
1013+
Config: testAccLustreFileSystemConfig_metadata_iops(rName, "USER_PROVISIONED", 1500, 1200),
10141014
Check: resource.ComposeTestCheckFunc(
10151015
testAccCheckLustreFileSystemExists(ctx, resourceName, &filesystem2),
10161016
testAccCheckLustreFileSystemNotRecreated(&filesystem1, &filesystem2),
@@ -1036,7 +1036,7 @@ func TestAccFSxLustreFileSystem_metadataConfig_increase(t *testing.T) {
10361036
CheckDestroy: testAccCheckLustreFileSystemDestroy(ctx),
10371037
Steps: []resource.TestStep{
10381038
{
1039-
Config: testAccLustreFileSystemConfig_metadata_iops(rName, "USER_PROVISIONED", 1500),
1039+
Config: testAccLustreFileSystemConfig_metadata_iops(rName, "USER_PROVISIONED", 1500, 1200),
10401040
Check: resource.ComposeTestCheckFunc(
10411041
testAccCheckLustreFileSystemExists(ctx, resourceName, &filesystem1),
10421042
resource.TestCheckResourceAttr(resourceName, "metadata_configuration.#", "1"),
@@ -1051,7 +1051,7 @@ func TestAccFSxLustreFileSystem_metadataConfig_increase(t *testing.T) {
10511051
ImportStateVerifyIgnore: []string{names.AttrSecurityGroupIDs},
10521052
},
10531053
{
1054-
Config: testAccLustreFileSystemConfig_metadata_iops(rName, "USER_PROVISIONED", 3000),
1054+
Config: testAccLustreFileSystemConfig_metadata_iops(rName, "USER_PROVISIONED", 3000, 1200),
10551055
Check: resource.ComposeTestCheckFunc(
10561056
testAccCheckLustreFileSystemExists(ctx, resourceName, &filesystem2),
10571057
testAccCheckLustreFileSystemNotRecreated(&filesystem1, &filesystem2),
@@ -1077,7 +1077,7 @@ func TestAccFSxLustreFileSystem_metadataConfig_decrease(t *testing.T) {
10771077
CheckDestroy: testAccCheckLustreFileSystemDestroy(ctx),
10781078
Steps: []resource.TestStep{
10791079
{
1080-
Config: testAccLustreFileSystemConfig_metadata_iops(rName, "USER_PROVISIONED", 3000),
1080+
Config: testAccLustreFileSystemConfig_metadata_iops(rName, "USER_PROVISIONED", 3000, 1200),
10811081
Check: resource.ComposeTestCheckFunc(
10821082
testAccCheckLustreFileSystemExists(ctx, resourceName, &filesystem1),
10831083
resource.TestCheckResourceAttr(resourceName, "metadata_configuration.#", "1"),
@@ -1092,7 +1092,7 @@ func TestAccFSxLustreFileSystem_metadataConfig_decrease(t *testing.T) {
10921092
ImportStateVerifyIgnore: []string{names.AttrSecurityGroupIDs},
10931093
},
10941094
{
1095-
Config: testAccLustreFileSystemConfig_metadata_iops(rName, "USER_PROVISIONED", 1500),
1095+
Config: testAccLustreFileSystemConfig_metadata_iops(rName, "USER_PROVISIONED", 1500, 1200),
10961096
Check: resource.ComposeTestCheckFunc(
10971097
testAccCheckLustreFileSystemExists(ctx, resourceName, &filesystem2),
10981098
testAccCheckLustreFileSystemRecreated(&filesystem1, &filesystem2),
@@ -1105,6 +1105,50 @@ func TestAccFSxLustreFileSystem_metadataConfig_decrease(t *testing.T) {
11051105
})
11061106
}
11071107

1108+
func TestAccFSxLustreFileSystem_metadataConfig_increaseWithStorageCapacity(t *testing.T) {
1109+
ctx := acctest.Context(t)
1110+
var filesystem1, filesystem2 awstypes.FileSystem
1111+
resourceName := "aws_fsx_lustre_file_system.test"
1112+
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)
1113+
1114+
resource.ParallelTest(t, resource.TestCase{
1115+
PreCheck: func() { acctest.PreCheck(ctx, t); acctest.PreCheckPartitionHasService(t, names.FSxEndpointID) },
1116+
ErrorCheck: acctest.ErrorCheck(t, names.FSxServiceID),
1117+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
1118+
CheckDestroy: testAccCheckLustreFileSystemDestroy(ctx),
1119+
Steps: []resource.TestStep{
1120+
{
1121+
Config: testAccLustreFileSystemConfig_metadata_iops(rName, "USER_PROVISIONED", 1500, 1200),
1122+
Check: resource.ComposeTestCheckFunc(
1123+
testAccCheckLustreFileSystemExists(ctx, resourceName, &filesystem1),
1124+
resource.TestCheckResourceAttr(resourceName, "metadata_configuration.#", "1"),
1125+
resource.TestCheckResourceAttr(resourceName, "metadata_configuration.0.mode", "USER_PROVISIONED"),
1126+
resource.TestCheckResourceAttr(resourceName, "metadata_configuration.0.iops", "1500"),
1127+
resource.TestCheckResourceAttr(resourceName, "storage_capacity", "1200"),
1128+
),
1129+
},
1130+
{
1131+
ResourceName: resourceName,
1132+
ImportState: true,
1133+
ImportStateVerify: true,
1134+
ImportStateVerifyIgnore: []string{names.AttrSecurityGroupIDs},
1135+
},
1136+
{
1137+
// When storage_capacity is increased to 2400, IOPS must be increased to at least 3000.
1138+
Config: testAccLustreFileSystemConfig_metadata_iops(rName, "USER_PROVISIONED", 3000, 2400),
1139+
Check: resource.ComposeTestCheckFunc(
1140+
testAccCheckLustreFileSystemExists(ctx, resourceName, &filesystem2),
1141+
testAccCheckLustreFileSystemNotRecreated(&filesystem1, &filesystem2),
1142+
resource.TestCheckResourceAttr(resourceName, "metadata_configuration.#", "1"),
1143+
resource.TestCheckResourceAttr(resourceName, "metadata_configuration.0.mode", "USER_PROVISIONED"),
1144+
resource.TestCheckResourceAttr(resourceName, "metadata_configuration.0.iops", "3000"),
1145+
resource.TestCheckResourceAttr(resourceName, "storage_capacity", "2400"),
1146+
),
1147+
},
1148+
},
1149+
})
1150+
}
1151+
11081152
func TestAccFSxLustreFileSystem_rootSquashConfig(t *testing.T) {
11091153
ctx := acctest.Context(t)
11101154
var filesystem awstypes.FileSystem
@@ -2015,10 +2059,10 @@ resource "aws_fsx_lustre_file_system" "test" {
20152059
`, rName, mode))
20162060
}
20172061

2018-
func testAccLustreFileSystemConfig_metadata_iops(rName, mode string, iops int) string {
2062+
func testAccLustreFileSystemConfig_metadata_iops(rName, mode string, iops, storageCapacity int) string {
20192063
return acctest.ConfigCompose(testAccLustreFileSystemConfig_base(rName), fmt.Sprintf(`
20202064
resource "aws_fsx_lustre_file_system" "test" {
2021-
storage_capacity = 1200
2065+
storage_capacity = %[4]d
20222066
subnet_ids = aws_subnet.test[*].id
20232067
deployment_type = "PERSISTENT_2"
20242068
per_unit_storage_throughput = 125
@@ -2032,7 +2076,7 @@ resource "aws_fsx_lustre_file_system" "test" {
20322076
Name = %[1]q
20332077
}
20342078
}
2035-
`, rName, mode, iops))
2079+
`, rName, mode, iops, storageCapacity))
20362080
}
20372081

20382082
func testAccLustreFileSystemConfig_rootSquash(rName, uid string) string {

0 commit comments

Comments
 (0)