Skip to content

Commit

Permalink
Cleanup security group created by e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
mdbooth committed Apr 10, 2024
1 parent 626738a commit 43d2499
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/e2e/shared/openstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,16 @@ func CreateOpenStackSecurityGroup(e2eCtx *E2EContext, securityGroupName, descrip
Description: description,
}

_, err = groups.Create(networkClient, createOpts).Extract()
group, err := groups.Create(networkClient, createOpts).Extract()
if err != nil {
return err
}
// Ensure the group is deleted after the test
DeferCleanup(func() error {
By(fmt.Sprintf("Deleting test security group %s(%s)", group.Name, group.ID))
return groups.Delete(networkClient, group.ID).ExtractErr()
})

return nil
}

Expand Down

0 comments on commit 43d2499

Please sign in to comment.