Skip to content

Commit 0fe8dc3

Browse files
authored
test(rdb): add test for instance update node type (scaleway#2544)
* test(rdb): add test for update node_type * test(rdb): add test for update node_type * Update instance_test.go * fix lint instance_test.go
1 parent 542005e commit 0fe8dc3

File tree

2 files changed

+2319
-0
lines changed

2 files changed

+2319
-0
lines changed

internal/services/rdb/instance_test.go

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,64 @@ func TestAccInstance_ChangeVolumeType(t *testing.T) {
10311031
})
10321032
}
10331033

1034+
func TestAccInstance_ChangeNodeType(t *testing.T) {
1035+
tt := acctest.NewTestTools(t)
1036+
defer tt.Cleanup()
1037+
1038+
latestEngineVersion := rdbchecks.GetLatestEngineVersion(tt, postgreSQLEngineName)
1039+
1040+
resource.ParallelTest(t, resource.TestCase{
1041+
PreCheck: func() { acctest.PreCheck(t) },
1042+
1043+
ProviderFactories: tt.ProviderFactories,
1044+
CheckDestroy: rdbchecks.IsInstanceDestroyed(tt),
1045+
Steps: []resource.TestStep{
1046+
{
1047+
Config: fmt.Sprintf(`
1048+
resource scaleway_rdb_instance main {
1049+
name = "test-rdb-instance-volume"
1050+
node_type = "db-play2-pico"
1051+
engine = %q
1052+
is_ha_cluster = false
1053+
disable_backup = true
1054+
user_name = "my_initial_user"
1055+
password = "thiZ_is_v&ry_s3cret"
1056+
region= "nl-ams"
1057+
tags = [ "terraform-test", "scaleway_rdb_instance" ]
1058+
volume_type = "bssd"
1059+
volume_size_in_gb = 10
1060+
}
1061+
`, latestEngineVersion),
1062+
Check: resource.ComposeTestCheckFunc(
1063+
isInstancePresent(tt, "scaleway_rdb_instance.main"),
1064+
resource.TestCheckResourceAttr("scaleway_rdb_instance.main", "node_type", "db-play2-pico"),
1065+
),
1066+
},
1067+
{
1068+
Config: fmt.Sprintf(`
1069+
resource scaleway_rdb_instance main {
1070+
name = "test-rdb-instance-volume"
1071+
node_type = "db-play2-nano"
1072+
engine = %q
1073+
is_ha_cluster = false
1074+
disable_backup = true
1075+
user_name = "my_initial_user"
1076+
password = "thiZ_is_v&ry_s3cret"
1077+
region= "nl-ams"
1078+
tags = [ "terraform-test", "scaleway_rdb_instance"]
1079+
volume_type = "bssd"
1080+
volume_size_in_gb = 10
1081+
}
1082+
`, latestEngineVersion),
1083+
Check: resource.ComposeTestCheckFunc(
1084+
isInstancePresent(tt, "scaleway_rdb_instance.main"),
1085+
resource.TestCheckResourceAttr("scaleway_rdb_instance.main", "node_type", "db-play2-nano"),
1086+
),
1087+
},
1088+
},
1089+
})
1090+
}
1091+
10341092
func TestAccInstance_Endpoints(t *testing.T) {
10351093
tt := acctest.NewTestTools(t)
10361094
defer tt.Cleanup()

internal/services/rdb/testdata/instance-change-node-type.cassette.yaml

Lines changed: 2261 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)