Skip to content

Commit

Permalink
Merge pull request #2010 from shiftstack/cleanuptestsg
Browse files Browse the repository at this point in the history
🌱 Cleanup security group created by e2e test
  • Loading branch information
k8s-ci-robot authored Apr 11, 2024
2 parents 626738a + 43d2499 commit c834e9c
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 c834e9c

Please sign in to comment.