Skip to content

Commit

Permalink
Fix Test_AdminOrgCreateCatalog
Browse files Browse the repository at this point in the history
The creation task may not be available after a recent fix
to catalog creation (PR vmware#590). Accessing the task directly
may lead to a panic. The check is replaced with a more
resilient function call (ResourceComplete)

Signed-off-by: Giuseppe Maxia <gmaxia@vmware.com>
  • Loading branch information
Giuseppe Maxia committed Jul 31, 2023
1 parent e688666 commit b9860ad
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions govcd/org_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,9 @@ func (vcd *TestVCD) Test_AdminOrgCreateCatalog(check *C) {
AddToCleanupList(TestCreateCatalog, "catalog", vcd.org.Org.Name, "Test_CreateCatalog")
check.Assert(adminCatalog.AdminCatalog.Name, Equals, TestCreateCatalog)
check.Assert(adminCatalog.AdminCatalog.Description, Equals, TestCreateCatalogDesc)
task := NewTask(&vcd.client.Client)
task.Task = adminCatalog.AdminCatalog.Tasks.Task[0]
err = task.WaitTaskCompletion()
check.Assert(err, IsNil)
// Immediately after the catalog creation, the creation task should be already complete
check.Assert(ResourceComplete(adminCatalog.AdminCatalog.Tasks), Equals, true)

adminOrg, err = vcd.client.GetAdminOrgByName(vcd.org.Org.Name)
check.Assert(err, IsNil)
copyAdminCatalog, err := adminOrg.GetAdminCatalogByName(TestCreateCatalog, false)
Expand Down

0 comments on commit b9860ad

Please sign in to comment.