Skip to content

Commit

Permalink
Allow location to be changed for ibm-cloud-databases acceptance tests (
Browse files Browse the repository at this point in the history
…IBM-Cloud#3713)

* modified resource tests to allow us to modify location

* added ability to modify location for data sources

* set default to eu-gb

* made test adjustments required in PR
  • Loading branch information
omaraibrahim authored and SunithaGudisagarIBM1 committed Sep 14, 2022
1 parent a42f8a6 commit 6f3adf4
Show file tree
Hide file tree
Showing 12 changed files with 197 additions and 194 deletions.
7 changes: 7 additions & 0 deletions ibm/acctest/acctest.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ var IksSa string
var IksClusterVpcID string
var IksClusterSubnetID string
var IksClusterResourceGroupID string
var IcdDbRegion string

// For Power Colo

Expand Down Expand Up @@ -519,6 +520,12 @@ func init() {
fmt.Println("[INFO] Set the environment variable SL_ROUTE_NEXTHOP for testing ibm_is_vpc_route else it is set to default value '10.0.0.4'")
}

IcdDbRegion = os.Getenv("ICD_DB_REGION")
if IcdDbRegion == "" {
IcdDbRegion = "eu-gb"
fmt.Println("[INFO] Set the environment variable ICD_DB_REGION for testing ibm_cloud_databases else it is set to default value 'eu-gb'")
}

// Added for Power Colo Testing
Pi_image = os.Getenv("PI_IMAGE")
if Pi_image == "" {
Expand Down
6 changes: 3 additions & 3 deletions ibm/service/database/data_source_ibm_database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestAccIBMDatabaseDataSource_basic(t *testing.T) {
resource.TestCheckResourceAttr(dataName, "name", testName),
resource.TestCheckResourceAttr(dataName, "service", "databases-for-postgresql"),
resource.TestCheckResourceAttr(dataName, "plan", "standard"),
resource.TestCheckResourceAttr(dataName, "location", "us-south"),
resource.TestCheckResourceAttr(dataName, "location", acc.IcdDbRegion),
resource.TestCheckResourceAttr(dataName, "adminuser", "admin"),
resource.TestCheckResourceAttr(dataName, "members_memory_allocation_mb", "2048"),
resource.TestCheckResourceAttr(dataName, "members_disk_allocation_mb", "10240"),
Expand Down Expand Up @@ -67,9 +67,9 @@ func testAccCheckIBMDatabaseDataSourceConfig(databaseResourceGroup string, name
name = "%[2]s"
service = "databases-for-postgresql"
plan = "standard"
location = "us-south"
location = "%[3]s"
tags = ["one:two"]
}
`, databaseResourceGroup, name)
`, databaseResourceGroup, name, acc.IcdDbRegion)
}
75 changes: 36 additions & 39 deletions ibm/service/database/resource_ibm_database_cassandra_test.go

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions ibm/service/database/resource_ibm_database_edb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestAccIBMEDBDatabaseInstanceBasic(t *testing.T) {
resource.TestCheckResourceAttr(name, "name", testName),
resource.TestCheckResourceAttr(name, "service", "databases-for-enterprisedb"),
resource.TestCheckResourceAttr(name, "plan", "standard"),
resource.TestCheckResourceAttr(name, "location", "us-south"),
resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion),
resource.TestCheckResourceAttr(name, "adminuser", "admin"),
resource.TestCheckResourceAttr(name, "members_memory_allocation_mb", "3072"),
resource.TestCheckResourceAttr(name, "members_disk_allocation_mb", "61440"),
Expand All @@ -55,7 +55,7 @@ func TestAccIBMEDBDatabaseInstanceBasic(t *testing.T) {
resource.TestCheckResourceAttr(name, "name", testName),
resource.TestCheckResourceAttr(name, "service", "databases-for-enterprisedb"),
resource.TestCheckResourceAttr(name, "plan", "standard"),
resource.TestCheckResourceAttr(name, "location", "us-south"),
resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion),
resource.TestCheckResourceAttr(name, "members_memory_allocation_mb", "6144"),
resource.TestCheckResourceAttr(name, "members_disk_allocation_mb", "92160"),
resource.TestCheckResourceAttr(name, "service_endpoints", "public-and-private"),
Expand All @@ -78,7 +78,7 @@ func TestAccIBMEDBDatabaseInstanceBasic(t *testing.T) {
resource.TestCheckResourceAttr(name, "name", testName),
resource.TestCheckResourceAttr(name, "service", "databases-for-enterprisedb"),
resource.TestCheckResourceAttr(name, "plan", "standard"),
resource.TestCheckResourceAttr(name, "location", "us-south"),
resource.TestCheckResourceAttr(name, "location", acc.IcdDbRegion),
resource.TestCheckResourceAttr(name, "members_memory_allocation_mb", "3072"),
resource.TestCheckResourceAttr(name, "members_disk_allocation_mb", "92160"),
resource.TestCheckResourceAttr(name, "whitelist.#", "0"),
Expand Down Expand Up @@ -109,7 +109,7 @@ func testAccCheckIBMDatabaseInstanceEDBBasic(databaseResourceGroup string, name
name = "%[2]s"
service = "databases-for-enterprisedb"
plan = "standard"
location = "us-south"
location = "%[3]s"
adminpassword = "password12"
members_memory_allocation_mb = 3072
members_disk_allocation_mb = 61440
Expand All @@ -128,7 +128,7 @@ func testAccCheckIBMDatabaseInstanceEDBBasic(databaseResourceGroup string, name
delete = "15m"
}
}
`, databaseResourceGroup, name)
`, databaseResourceGroup, name, acc.IcdDbRegion)
}

func testAccCheckIBMDatabaseInstanceEDBFullyspecified(databaseResourceGroup string, name string) string {
Expand All @@ -142,7 +142,7 @@ func testAccCheckIBMDatabaseInstanceEDBFullyspecified(databaseResourceGroup stri
name = "%[2]s"
service = "databases-for-enterprisedb"
plan = "standard"
location = "us-south"
location = "%[3]s"
adminpassword = "password12"
members_memory_allocation_mb = 6144
members_disk_allocation_mb = 92160
Expand Down Expand Up @@ -171,7 +171,7 @@ func testAccCheckIBMDatabaseInstanceEDBFullyspecified(databaseResourceGroup stri
delete = "15m"
}
}
`, databaseResourceGroup, name)
`, databaseResourceGroup, name, acc.IcdDbRegion)
}

func testAccCheckIBMDatabaseInstanceEDBReduced(databaseResourceGroup string, name string) string {
Expand All @@ -185,7 +185,7 @@ func testAccCheckIBMDatabaseInstanceEDBReduced(databaseResourceGroup string, nam
name = "%[2]s"
service = "databases-for-enterprisedb"
plan = "standard"
location = "us-south"
location = "%[3]s"
adminpassword = "password12"
members_memory_allocation_mb = 3072
members_disk_allocation_mb = 92160
Expand All @@ -197,5 +197,5 @@ func testAccCheckIBMDatabaseInstanceEDBReduced(databaseResourceGroup string, nam
delete = "15m"
}
}
`, databaseResourceGroup, name)
`, databaseResourceGroup, name, acc.IcdDbRegion)
}
Loading

0 comments on commit 6f3adf4

Please sign in to comment.