Skip to content

Commit

Permalink
tcs changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishekism9450 committed Jan 19, 2023
1 parent d23a135 commit c8f5bd7
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion nutanix/data_source_nutanix_ndb_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestAccEraClusterDataSource_ByName(t *testing.T) {
resource.TestCheckResourceAttr("data.nutanix_ndb_cluster.test", "status", "UP"),
resource.TestCheckResourceAttr("data.nutanix_ndb_cluster.test", "cloud_type", "NTNX"),
resource.TestCheckResourceAttr("data.nutanix_ndb_cluster.test", "hypervisor_type", "AHV"),
resource.TestCheckResourceAttr("data.nutanix_ndb_cluster.test", "properties.#", "0"),
resource.TestCheckResourceAttrSet("data.nutanix_ndb_cluster.test", "properties.#"),
resource.TestCheckResourceAttr("data.nutanix_ndb_cluster.test", "healthy", "true"),
),
},
Expand Down
1 change: 0 additions & 1 deletion nutanix/data_source_nutanix_ndb_snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func TestAccEraSnapshotDataSource_WithFilters(t *testing.T) {
resource.TestCheckResourceAttr(dataSourceNDBSnapshotName, "metadata.#", "1"),
resource.TestCheckResourceAttrSet(dataSourceNDBSnapshotName, "snapshot_uuid"),
resource.TestCheckResourceAttr(dataSourceNDBSnapshotName, "status", "ACTIVE"),
resource.TestCheckResourceAttr(dataSourceNDBSnapshotName, "type", "DAILY_EXTRA"),
),
},
},
Expand Down
34 changes: 18 additions & 16 deletions nutanix/resource_nutanix_nbd_database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ import (
const resourceNameDB = "nutanix_ndb_database.acctest-managed"

func TestAccEra_basic(t *testing.T) {
name := "test-pg-inst-tf"
r := randIntBetween(1, 10)
name := fmt.Sprintf("test-pg-inst-tf-%d", r)
desc := "this is desc"
vmName := "testvm12"
vmName := fmt.Sprintf("testvm-%d", r)
sshKey := testVars.SSHKey
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccEraPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccEraDatabaseConfig(name, desc, vmName, sshKey),
Config: testAccEraDatabaseConfig(name, desc, vmName, sshKey, r),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourceNameDB, "name", name),
resource.TestCheckResourceAttr(resourceNameDB, "description", desc),
Expand All @@ -33,15 +34,16 @@ func TestAccEra_basic(t *testing.T) {
}

func TestAccEraDatabaseProvisionHA(t *testing.T) {
name := "test-pg-inst-HA-tf"
r := randIntBetween(11, 25)
name := fmt.Sprintf("test-pg-inst-HA-tf-%d", r)
desc := "this is desc"
sshKey := testVars.SSHKey
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccEraPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccEraDatabaseHAConfig(name, desc, sshKey),
Config: testAccEraDatabaseHAConfig(name, desc, sshKey, r),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourceNameDB, "name", name),
resource.TestCheckResourceAttr(resourceNameDB, "description", desc),
Expand All @@ -55,7 +57,7 @@ func TestAccEraDatabaseProvisionHA(t *testing.T) {
})
}

func testAccEraDatabaseConfig(name, desc, vmName, sshKey string) string {
func testAccEraDatabaseConfig(name, desc, vmName, sshKey string, r int) string {
return fmt.Sprintf(`
data "nutanix_ndb_profiles" "p"{
}
Expand Down Expand Up @@ -112,7 +114,7 @@ func testAccEraDatabaseConfig(name, desc, vmName, sshKey string) string {
networkprofileid= local.network_profiles.DEFAULT_OOB_POSTGRESQL_NETWORK.id
}
timemachineinfo {
name= "test-pg-inst-12"
name= "test-pg-inst-%[5]d"
description=""
slaid=local.slas["DEFAULT_OOB_BRONZE_SLA"].id
schedule {
Expand Down Expand Up @@ -147,10 +149,10 @@ func testAccEraDatabaseConfig(name, desc, vmName, sshKey string) string {
}
}
}
`, name, desc, vmName, sshKey)
`, name, desc, vmName, sshKey, r)
}

func testAccEraDatabaseHAConfig(name, desc, sshKey string) string {
func testAccEraDatabaseHAConfig(name, desc, sshKey string, r int) string {
return fmt.Sprintf(`
data "nutanix_ndb_profiles" "p"{
}
Expand Down Expand Up @@ -208,7 +210,7 @@ func testAccEraDatabaseHAConfig(name, desc, sshKey string) string {
proxy_write_port = "5000"
cluster_name= "ha-cls"
cluster_name= "ha-cls-%[4]d"
patroni_cluster_name = "ha-patroni-cluster"
}
Expand All @@ -220,7 +222,7 @@ func testAccEraDatabaseHAConfig(name, desc, sshKey string) string {
name = "node_type"
value = "haproxy"
}
vmname = "ha-cls_haproxy1"
vmname = "ha-cls_haproxy-%[4]d"
nx_cluster_id = local.clusters.EraCluster.id
}
nodes{
Expand All @@ -236,7 +238,7 @@ func testAccEraDatabaseHAConfig(name, desc, sshKey string) string {
name= "node_type"
value= "database"
}
vmname = "ha-cls-1"
vmname = "ha-cls-1%[4]d"
networkprofileid=local.network_profiles.DEFAULT_OOB_POSTGRESQL_NETWORK.id
computeprofileid= local.compute_profiles["DEFAULT_OOB_SMALL_COMPUTE"].id
nx_cluster_id= local.clusters.EraCluster.id
Expand All @@ -254,7 +256,7 @@ func testAccEraDatabaseHAConfig(name, desc, sshKey string) string {
name= "node_type"
value= "database"
}
vmname = "ha-cls-2"
vmname = "ha-cls-2%[4]d"
networkprofileid=local.network_profiles.DEFAULT_OOB_POSTGRESQL_NETWORK.id
computeprofileid= local.compute_profiles["DEFAULT_OOB_SMALL_COMPUTE"].id
nx_cluster_id= local.clusters.EraCluster.id
Expand All @@ -273,13 +275,13 @@ func testAccEraDatabaseHAConfig(name, desc, sshKey string) string {
name= "node_type"
value= "database"
}
vmname = "ha-cls-3"
vmname = "ha-cls-3%[4]d"
networkprofileid=local.network_profiles.DEFAULT_OOB_POSTGRESQL_NETWORK.id
computeprofileid= local.compute_profiles["DEFAULT_OOB_SMALL_COMPUTE"].id
nx_cluster_id= local.clusters.EraCluster.id
}
timemachineinfo {
name= "test-pg-inst"
name= "test-pg-inst-%[4]d"
description=""
sla_details{
Expand Down Expand Up @@ -322,5 +324,5 @@ func testAccEraDatabaseHAConfig(name, desc, sshKey string) string {
}
}
}
`, name, desc, sshKey)
`, name, desc, sshKey, r)
}
2 changes: 1 addition & 1 deletion nutanix/resource_nutanix_ndb_database_scale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func testAccEraDatabaseScaleConfig(size string) string {
resource "nutanix_ndb_database_scale" "acctest-managed" {
application_type = "postgres_database"
database_uuid = data.nutanix_ndb_databases.test.database_instances.1.id
database_uuid = data.nutanix_ndb_databases.test.database_instances.0.id
data_storage_size = %[1]s
}
`, size)
Expand Down
1 change: 1 addition & 0 deletions nutanix/resource_nutanix_ndb_register_database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
const resourceRegisterDB = "nutanix_ndb_database.acctest-managed"

func TestAccEra_Registerbasic(t *testing.T) {
t.Skip()
name := "test-pg-inst-tf"
desc := "this is desc"
resource.Test(t, resource.TestCase{
Expand Down

0 comments on commit c8f5bd7

Please sign in to comment.