Skip to content

Commit

Permalink
Test fixes (IBM-Cloud#5812)
Browse files Browse the repository at this point in the history
Co-authored-by: Lorna-Kelly <[email protected]>
  • Loading branch information
lornakelly and Lorna-Kelly authored Nov 22, 2024
1 parent 02ddca6 commit 201986b
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ func testAccCheckIBMDatabaseDataSourceConfig3(name string) string {
plan = "standard"
location = "%[2]s"
tags = ["one:two"]
service_endpoints = "private"
}
`, name, acc.Region())
`, name, acc.Region())
}

func testAccCheckIBMDatabasePitrDataSourceConfigBasic(name string) string {
Expand Down
2 changes: 2 additions & 0 deletions ibm/service/database/data_source_ibm_database_remotes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func testAccCheckIBMDatabaseDataSourceConfig4(name string) string {
plan = "standard"
location = "%[2]s"
tags = ["one:two"]
service_endpoints = "private"
}
resource "ibm_database" "db_replica" {
Expand All @@ -61,6 +62,7 @@ func testAccCheckIBMDatabaseDataSourceConfig4(name string) string {
plan = "standard"
location = "%[2]s"
tags = ["one:two"]
service_endpoints = "private"
depends_on = [
ibm_database.db,
Expand Down
14 changes: 11 additions & 3 deletions ibm/service/database/data_source_ibm_database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccIBMDatabaseDataSource_basic(t *testing.T) {
func TestAccIBMDatabaseDataSourceBasic(t *testing.T) {
t.Parallel()
databaseResourceGroup := "default"
var databaseInstanceOne string
Expand All @@ -36,7 +36,7 @@ func TestAccIBMDatabaseDataSource_basic(t *testing.T) {
resource.TestCheckResourceAttr(dataName, "plan", "standard"),
resource.TestCheckResourceAttr(dataName, "location", acc.Region()),
resource.TestCheckResourceAttr(dataName, "adminuser", "admin"),
resource.TestCheckResourceAttr(dataName, "groups.0.memory.0.allocation_mb", "2048"),
resource.TestCheckResourceAttr(dataName, "groups.0.memory.0.allocation_mb", "8192"),
resource.TestCheckResourceAttr(dataName, "groups.0.disk.0.allocation_mb", "10240"),
resource.TestCheckResourceAttr(dataName, "allowlist.#", "0"),
resource.TestCheckResourceAttr(dataName, "tags.#", "1"),
Expand Down Expand Up @@ -65,7 +65,15 @@ func testAccCheckIBMDatabaseDataSourceConfig(databaseResourceGroup string, name
location = "%[3]s"
tags = ["one:two"]
service_endpoints = "public"
group {
group_id = "member"
host_flavor {
id = "multitenant"
}
}
}
`, databaseResourceGroup, name, acc.Region())
`, databaseResourceGroup, name, acc.Region())
}
3 changes: 2 additions & 1 deletion ibm/service/database/resource_ibm_database_edb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestAccIBMEDBDatabaseInstanceBasic(t *testing.T) {
resource.TestCheckResourceAttr(name, "adminuser", "admin"),
resource.TestCheckResourceAttr(name, "groups.0.memory.0.allocation_mb", "49152"),
resource.TestCheckResourceAttr(name, "groups.0.disk.0.allocation_mb", "61440"),
resource.TestCheckResourceAttr(name, "service_endpoints", "public"),
resource.TestCheckResourceAttr(name, "service_endpoints", "public-and-private"),
resource.TestCheckResourceAttr(name, "allowlist.#", "1"),
resource.TestCheckResourceAttr(name, "users.#", "1"),
resource.TestCheckResourceAttr(name, "tags.#", "1"),
Expand Down Expand Up @@ -159,6 +159,7 @@ func testAccCheckIBMDatabaseInstanceEDBMinimal(databaseResourceGroup string, nam
plan = "standard"
location = "%[3]s"
service_endpoints = "public-and-private"
group {
group_id = "member"
host_flavor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,12 @@ func TestAccIBMDatabaseInstance_ElasticsearchPlatinum_Group(t *testing.T) {

func TestAccIBMDatabaseInstanceElasticsearchPlatinumImport(t *testing.T) {
t.Parallel()

databaseResourceGroup := "default"

var databaseInstanceOne string

serviceName := fmt.Sprintf("tf-Es-%d", acctest.RandIntRange(10, 100))
//serviceName := "test_acc"
resourceName := "ibm_database." + serviceName

resource.Test(t, resource.TestCase{
Expand Down Expand Up @@ -322,7 +324,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumBasic(databaseResourceG
delete = "15m"
}
}
`, databaseResourceGroup, name, acc.Region())
`, databaseResourceGroup, name, acc.Region())
}

func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumFullyspecified(databaseResourceGroup string, name string) string {
Expand Down Expand Up @@ -371,7 +373,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumFullyspecified(database
}
}
`, databaseResourceGroup, name, acc.Region())
`, databaseResourceGroup, name, acc.Region())
}

func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumReduced(databaseResourceGroup string, name string) string {
Expand Down Expand Up @@ -403,7 +405,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumReduced(databaseResourc
delete = "15m"
}
}
`, databaseResourceGroup, name, acc.Region())
`, databaseResourceGroup, name, acc.Region())
}

func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupMigration(databaseResourceGroup string, name string) string {
Expand Down Expand Up @@ -439,7 +441,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupMigration(database
delete = "15m"
}
}
`, databaseResourceGroup, name, acc.Region())
`, databaseResourceGroup, name, acc.Region())
}

func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeBasic(databaseResourceGroup string, name string) string {
Expand Down Expand Up @@ -485,7 +487,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeBasic(databaseResou
delete = "15m"
}
}
`, databaseResourceGroup, name, acc.Region())
`, databaseResourceGroup, name, acc.Region())
}

func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeFullyspecified(databaseResourceGroup string, name string) string {
Expand Down Expand Up @@ -538,7 +540,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeFullyspecified(data
delete = "15m"
}
}
`, databaseResourceGroup, name, acc.Region())
`, databaseResourceGroup, name, acc.Region())
}

func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeReduced(databaseResourceGroup string, name string) string {
Expand Down Expand Up @@ -575,7 +577,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeReduced(databaseRes
delete = "15m"
}
}
`, databaseResourceGroup, name, acc.Region())
`, databaseResourceGroup, name, acc.Region())
}

func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeScaleOut(databaseResourceGroup string, name string) string {
Expand Down Expand Up @@ -612,7 +614,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumNodeScaleOut(databaseRe
delete = "15m"
}
}
`, databaseResourceGroup, name, acc.Region())
`, databaseResourceGroup, name, acc.Region())
}

func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupBasic(databaseResourceGroup string, name string) string {
Expand Down Expand Up @@ -659,7 +661,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupBasic(databaseReso
delete = "15m"
}
}
`, databaseResourceGroup, name, acc.Region())
`, databaseResourceGroup, name, acc.Region())
}

func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupFullyspecified(databaseResourceGroup string, name string) string {
Expand Down Expand Up @@ -714,7 +716,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupFullyspecified(dat
}
}
`, databaseResourceGroup, name, acc.Region())
`, databaseResourceGroup, name, acc.Region())
}

func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupReduced(databaseResourceGroup string, name string) string {
Expand Down Expand Up @@ -752,7 +754,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupReduced(databaseRe
delete = "15m"
}
}
`, databaseResourceGroup, name, acc.Region())
`, databaseResourceGroup, name, acc.Region())
}

func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupScaleOut(databaseResourceGroup string, name string) string {
Expand Down Expand Up @@ -789,7 +791,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumGroupScaleOut(databaseR
delete = "15m"
}
}
`, databaseResourceGroup, name, acc.Region())
`, databaseResourceGroup, name, acc.Region())
}

func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumImport(databaseResourceGroup string, name string) string {
Expand All @@ -805,7 +807,7 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumImport(databaseResource
service = "databases-for-elasticsearch"
plan = "platinum"
location = "%[3]s"
service_endpoints = "public-and-private"
service_endpoints = "public-and-private"
timeouts {
create = "120m"
Expand All @@ -814,5 +816,5 @@ func testAccCheckIBMDatabaseInstanceElasticsearchPlatinumImport(databaseResource
}
}
`, databaseResourceGroup, name, acc.Region())
`, databaseResourceGroup, name, acc.Region())
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestAccIBMMongoDBEnterpriseDatabaseInstanceBasic(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"wait_time_minutes", "adminpassword", "group"},
"wait_time_minutes", "adminpassword", "group", "deletion_protection"},
},
},
})
Expand Down
4 changes: 2 additions & 2 deletions ibm/service/database/resource_ibm_database_mongodb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ func TestAccIBMDatabaseInstanceMongodbImport(t *testing.T) {
t.Parallel()
databaseResourceGroup := "default"
var databaseInstanceOne string

serviceName := fmt.Sprintf("tf-Mongo-%d", acctest.RandIntRange(10, 100))
//serviceName := "test_acc"
resourceName := "ibm_database." + serviceName

resource.Test(t, resource.TestCase{
Expand All @@ -108,7 +108,7 @@ func TestAccIBMDatabaseInstanceMongodbImport(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"wait_time_minutes"},
"wait_time_minutes", "deletion_protection"},
},
},
})
Expand Down

0 comments on commit 201986b

Please sign in to comment.