Skip to content

Commit cbe5213

Browse files
authored
chore: Add uuid for resource group tests (#1651)
Signed-off-by: Lei Jin <[email protected]>
1 parent 5edd4ca commit cbe5213

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

integration/resource_groups_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ import (
2222
"fmt"
2323
"testing"
2424

25+
"github.com/google/uuid"
26+
2527
"github.com/lacework/go-sdk/api"
2628
"github.com/pkg/errors"
2729
"github.com/stretchr/testify/assert"
2830
)
2931

30-
func createResourceGroup(typ string) (string, error) {
32+
func createResourceGroup(typ string, uid string) (string, error) {
3133
iType, _ := api.FindResourceGroupType(typ)
3234

3335
var testQuery api.RGQuery
@@ -37,7 +39,7 @@ func createResourceGroup(typ string) (string, error) {
3739
}
3840

3941
var testResourceGroup api.ResourceGroupDataWithQuery = api.ResourceGroupDataWithQuery{
40-
Name: fmt.Sprintf("CLI_TestCreateResourceGroup_%s", iType.String()),
42+
Name: fmt.Sprintf("CLI_TestCreateResourceGroup_%s", iType.String()+"_"+uid),
4143
Type: iType.String(),
4244
Query: &testQuery,
4345
Description: "Resource Group Created By CLI Integration Testing",
@@ -172,9 +174,10 @@ func TestResourceGroupDelete(t *testing.T) {
172174
// skip lw_account
173175
t.Run(i.String(), func(t *testing.T) {
174176
// setup resource group
175-
resourceGroupID, err := createResourceGroup(i.String())
177+
uid := uuid.New().String()[:8]
178+
resourceGroupID, err := createResourceGroup(i.String(), uid)
176179
if err != nil {
177-
assert.FailNow(t, err.Error(), fmt.Sprintf("Manually delete resourceGroup CLI_TestCreateResourceGroup_%s", i.String()))
180+
assert.FailNow(t, err.Error(), fmt.Sprintf("Manually delete resourceGroup CLI_TestCreateResourceGroup_%s", i.String()+"_"+uid))
178181
}
179182

180183
// delete resource group

0 commit comments

Comments
 (0)