Skip to content

Commit c834e9c

Browse files
authored
Merge pull request #2010 from shiftstack/cleanuptestsg
🌱 Cleanup security group created by e2e test
2 parents 626738a + 43d2499 commit c834e9c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/e2e/shared/openstack.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -494,10 +494,16 @@ func CreateOpenStackSecurityGroup(e2eCtx *E2EContext, securityGroupName, descrip
494494
Description: description,
495495
}
496496

497-
_, err = groups.Create(networkClient, createOpts).Extract()
497+
group, err := groups.Create(networkClient, createOpts).Extract()
498498
if err != nil {
499499
return err
500500
}
501+
// Ensure the group is deleted after the test
502+
DeferCleanup(func() error {
503+
By(fmt.Sprintf("Deleting test security group %s(%s)", group.Name, group.ID))
504+
return groups.Delete(networkClient, group.ID).ExtractErr()
505+
})
506+
501507
return nil
502508
}
503509

0 commit comments

Comments
 (0)