From cbe5213a1685dc93be2c5c6e20caf8a89a3830f7 Mon Sep 17 00:00:00 2001 From: Lei Jin <166442440+leijin-lw@users.noreply.github.com> Date: Tue, 16 Jul 2024 16:05:45 -0700 Subject: [PATCH] chore: Add uuid for resource group tests (#1651) Signed-off-by: Lei Jin --- integration/resource_groups_test.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/integration/resource_groups_test.go b/integration/resource_groups_test.go index c1cac14ac..bcbddcb46 100644 --- a/integration/resource_groups_test.go +++ b/integration/resource_groups_test.go @@ -22,12 +22,14 @@ import ( "fmt" "testing" + "github.com/google/uuid" + "github.com/lacework/go-sdk/api" "github.com/pkg/errors" "github.com/stretchr/testify/assert" ) -func createResourceGroup(typ string) (string, error) { +func createResourceGroup(typ string, uid string) (string, error) { iType, _ := api.FindResourceGroupType(typ) var testQuery api.RGQuery @@ -37,7 +39,7 @@ func createResourceGroup(typ string) (string, error) { } var testResourceGroup api.ResourceGroupDataWithQuery = api.ResourceGroupDataWithQuery{ - Name: fmt.Sprintf("CLI_TestCreateResourceGroup_%s", iType.String()), + Name: fmt.Sprintf("CLI_TestCreateResourceGroup_%s", iType.String()+"_"+uid), Type: iType.String(), Query: &testQuery, Description: "Resource Group Created By CLI Integration Testing", @@ -172,9 +174,10 @@ func TestResourceGroupDelete(t *testing.T) { // skip lw_account t.Run(i.String(), func(t *testing.T) { // setup resource group - resourceGroupID, err := createResourceGroup(i.String()) + uid := uuid.New().String()[:8] + resourceGroupID, err := createResourceGroup(i.String(), uid) if err != nil { - assert.FailNow(t, err.Error(), fmt.Sprintf("Manually delete resourceGroup CLI_TestCreateResourceGroup_%s", i.String())) + assert.FailNow(t, err.Error(), fmt.Sprintf("Manually delete resourceGroup CLI_TestCreateResourceGroup_%s", i.String()+"_"+uid)) } // delete resource group