Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add uuid for resource group tests #1651

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions integration/resource_groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand Down Expand Up @@ -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
Expand Down
Loading