Skip to content

Commit

Permalink
Test further improved
Browse files Browse the repository at this point in the history
Signed-off-by: Dainius Serplis <[email protected]>
  • Loading branch information
Didainius committed Nov 14, 2024
1 parent 10bc8ed commit 8adc43a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 70 deletions.
58 changes: 0 additions & 58 deletions vcd/datasource_vcd_tm_org_vdc_test.go

This file was deleted.

19 changes: 7 additions & 12 deletions vcd/resource_vcd_tm_org_vdc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ func TestAccVcdTmOrgVdc(t *testing.T) {
}
testParamsNotEmpty(t, params)

preRequisites := vCenterHcl + nsxManagerHcl + regionHcl

// TODO: TM: There shouldn't be a need to create `preRequisites` separatelly, but region
// creation fails if it is spawned instantly after adding vCenter, therefore this extra step
// give time (with additional 'refresh' and 'refresh storage policies' operations on vCenter)
configText0 := templateFill(preRequisites, params)
configText0 := templateFill(vCenterHcl+nsxManagerHcl, params)
params["FuncName"] = t.Name() + "-step0"

preRequisites := vCenterHcl + nsxManagerHcl + regionHcl
configText1 := templateFill(preRequisites+testAccVcdTmOrgVdcStep1, params)
params["FuncName"] = t.Name() + "-step2"
configText2 := templateFill(preRequisites+testAccVcdTmOrgVdcStep2, params)
Expand All @@ -51,8 +50,6 @@ func TestAccVcdTmOrgVdc(t *testing.T) {
return
}

cachedRegionZoneId := &testCachedFieldValue{}

resource.Test(t, resource.TestCase{
ProviderFactories: testAccProviders,
Steps: []resource.TestStep{
Expand All @@ -62,7 +59,6 @@ func TestAccVcdTmOrgVdc(t *testing.T) {
{
Config: configText1,
Check: resource.ComposeTestCheckFunc(
cachedRegionZoneId.cacheTestResourceFieldValue("vcd_tm_region_zone.test", "id"),
resource.TestCheckResourceAttrSet("vcd_tm_org_vdc.test", "id"),
resource.TestCheckResourceAttr("vcd_tm_org_vdc.test", "is_enabled", "true"),
resource.TestCheckResourceAttr("vcd_tm_org_vdc.test", "status", "READY"),
Expand All @@ -72,7 +68,7 @@ func TestAccVcdTmOrgVdc(t *testing.T) {
resource.TestCheckTypeSetElemAttrPair("vcd_tm_org_vdc.test", "supervisor_ids.*", "data.vcd_tm_supervisor.test", "id"),
resource.TestCheckResourceAttr("vcd_tm_org_vdc.test", "zone_resource_allocations.#", "1"),
resource.TestCheckTypeSetElemNestedAttrs("vcd_tm_org_vdc.test", "zone_resource_allocations.*", map[string]string{
"region_zone_name": "{{.SupervisorZoneName}}",
"region_zone_name": testConfig.Tm.VcenterSupervisorZone,
"cpu_limit_mhz": "2000",
"cpu_reservation_mhz": "100",
"memory_limit_mib": "1024",
Expand All @@ -92,12 +88,11 @@ func TestAccVcdTmOrgVdc(t *testing.T) {
resource.TestCheckTypeSetElemAttrPair("vcd_tm_org_vdc.test", "supervisor_ids.*", "data.vcd_tm_supervisor.test", "id"),
resource.TestCheckResourceAttr("vcd_tm_org_vdc.test", "zone_resource_allocations.#", "1"),
resource.TestCheckTypeSetElemNestedAttrs("vcd_tm_org_vdc.test", "zone_resource_allocations.*", map[string]string{
"region_zone_name": "{{.SupervisorZoneName}}",
"region_zone_id": cachedRegionZoneId.fieldValue,
"region_zone_name": testConfig.Tm.VcenterSupervisorZone,
"cpu_limit_mhz": "1900",
"cpu_reservation_mhz": "100",
"memory_limit_mib": "1024",
"memory_reservation_mib": "512",
"cpu_reservation_mhz": "90",
"memory_limit_mib": "500",
"memory_reservation_mib": "200",
}),
),
},
Expand Down

0 comments on commit 8adc43a

Please sign in to comment.