Skip to content

Commit

Permalink
Improve test
Browse files Browse the repository at this point in the history
Signed-off-by: abarreiro <abarreiro@vmware.com>
  • Loading branch information
adambarreiro committed Jun 14, 2024
1 parent 6f65a2f commit 7f8fe2f
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions govcd/vdc_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,14 @@ func (vcd *TestVCD) Test_VdcTemplateInstantiate(check *C) {
vdc, err := org.GetVDCById(vdcId, true)
check.Assert(err, IsNil)
check.Assert(vdc, NotNil)
check.Assert(vdc.Vdc.ID, Equals, vdcId)
defer func() {
err = vdc.DeleteWait(true, true)
check.Assert(err, IsNil)
}()

err = vdc.DeleteWait(true, true)
check.Assert(err, IsNil)
check.Assert(vdc.Vdc.ID, Equals, vdcId)
check.Assert(vdc.Vdc.Name, Equals, check.TestName())
check.Assert(vdc.Vdc.Description, Equals, check.TestName())

// Instantiate the VDC Template as a Tenant
if len(vcd.config.Tenants) > 0 {
Expand All @@ -346,7 +350,7 @@ func (vcd *TestVCD) Test_VdcTemplateInstantiate(check *C) {
check.Assert(err, IsNil)
check.Assert(templateAsTenant, NotNil)

vdcId, err := templateAsTenant.Instantiate(check.TestName(), check.TestName(), org.AdminOrg.ID)
vdcId, err := templateAsTenant.Instantiate(check.TestName()+"2", check.TestName()+"2", org.AdminOrg.ID)
check.Assert(err, IsNil)
check.Assert(vdcId, Not(Equals), "")

Expand All @@ -355,10 +359,13 @@ func (vcd *TestVCD) Test_VdcTemplateInstantiate(check *C) {
vdc, err := org.GetVDCById(vdcId, true)
check.Assert(err, IsNil)
check.Assert(vdc, NotNil)
check.Assert(vdc.Vdc.ID, Equals, vdcId)

err = vdc.DeleteWait(true, true)
check.Assert(err, IsNil)
defer func() {
err = vdc.DeleteWait(true, true)
check.Assert(err, IsNil)
}()

check.Assert(vdc.Vdc.ID, Equals, vdcId)
check.Assert(vdc.Vdc.Name, Equals, check.TestName()+"2")
check.Assert(vdc.Vdc.Description, Equals, check.TestName()+"2")
}
}

0 comments on commit 7f8fe2f

Please sign in to comment.