From c9487d6437fb5a6108996dcfbefc8185537d7c5f Mon Sep 17 00:00:00 2001 From: George Blue Date: Wed, 29 May 2024 19:04:46 +0100 Subject: [PATCH] chore: drop the uuid dependency Following on from commit 965ad7cec5187a9f093a7df33c7dace2b28351ca, it was observed that it's possible to completely drop a dependency on a uuid generation package --- go.mod | 2 +- .../resource_run_failover_test.go | 10 +++++----- .../testhelpers/failover.go | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 398541b8..13dca972 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,6 @@ require ( github.com/Pallinder/go-randomdata v1.2.0 github.com/blang/semver/v4 v4.0.0 github.com/cloudfoundry/cloud-service-broker/v2 v2.0.2 - github.com/google/uuid v1.6.0 github.com/hashicorp/terraform-json v0.22.1 github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0 github.com/onsi/ginkgo/v2 v2.19.0 @@ -59,6 +58,7 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect github.com/google/s2a-go v0.1.7 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect diff --git a/providers/terraform-provider-csbmssqldbrunfailover/csbmssqldbrunfailover/resource_run_failover_test.go b/providers/terraform-provider-csbmssqldbrunfailover/csbmssqldbrunfailover/resource_run_failover_test.go index 45135e81..437e8f24 100644 --- a/providers/terraform-provider-csbmssqldbrunfailover/csbmssqldbrunfailover/resource_run_failover_test.go +++ b/providers/terraform-provider-csbmssqldbrunfailover/csbmssqldbrunfailover/resource_run_failover_test.go @@ -4,11 +4,11 @@ import ( "fmt" "os" + "csbbrokerpakazure/acceptance-tests/helpers/random" "csbbrokerpakazure/providers/terraform-provider-csbmssqldbrunfailover/csbmssqldbrunfailover" "csbbrokerpakazure/providers/terraform-provider-csbmssqldbrunfailover/testhelpers" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" - "github.com/google/uuid" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -45,13 +45,13 @@ var _ = Describe("resource_run_failover resource", Ordered, Label("acceptance"), var err error config = testhelpers.FailoverConfig{ - ResourceGroupName: fmt.Sprintf("resourcegroupname-%s", uuid.NewString()), - ServerName: fmt.Sprintf("servername-%s", uuid.NewString()), + ResourceGroupName: random.Name(random.WithPrefix("resourcegroup")), + ServerName: random.Name(random.WithPrefix("servername")), MainLocation: "eastus", PartnerServerLocation: "eastus2", - PartnerServerName: fmt.Sprintf("partnerservername-%s", uuid.NewString()), + PartnerServerName: random.Name(random.WithPrefix("partnerservername")), SubscriptionID: azureSubscriptionID, - FailoverGroupName: fmt.Sprintf("failovergroupname-%s", uuid.NewString()), + FailoverGroupName: random.Name(random.WithPrefix("failovergroupname")), } failoverData, err = testhelpers.CreateFailoverGroup(config) diff --git a/providers/terraform-provider-csbmssqldbrunfailover/testhelpers/failover.go b/providers/terraform-provider-csbmssqldbrunfailover/testhelpers/failover.go index 0a9b31df..3c06cbe4 100644 --- a/providers/terraform-provider-csbmssqldbrunfailover/testhelpers/failover.go +++ b/providers/terraform-provider-csbmssqldbrunfailover/testhelpers/failover.go @@ -3,14 +3,14 @@ package testhelpers import ( "context" - "fmt" + + "csbbrokerpakazure/acceptance-tests/helpers/random" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" - "github.com/google/uuid" ) type FailoverData struct { @@ -92,8 +92,8 @@ func createServer(ctx context.Context, cred azcore.TokenCredential, resourceGrou armsql.Server{ Location: to.Ptr(location), Properties: &armsql.ServerProperties{ - AdministratorLogin: to.Ptr(fmt.Sprintf("dummylogin-%s", uuid.NewString())), - AdministratorLoginPassword: to.Ptr(fmt.Sprintf("dummyPassword-%s", uuid.NewString())), + AdministratorLogin: to.Ptr(random.Name(random.WithPrefix("dummy-login"))), + AdministratorLoginPassword: to.Ptr(random.Hexadecimal()), }, }, nil,