From da7382980a356a0ddeaba3b727c867e97d9d8618 Mon Sep 17 00:00:00 2001 From: Vijay Rajah Date: Fri, 17 Apr 2020 00:17:39 +0530 Subject: [PATCH] Fix failing test & format code --- builder/azure/arm/tempname.go | 7 ++++--- builder/azure/arm/tempname_test.go | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/builder/azure/arm/tempname.go b/builder/azure/arm/tempname.go index 1f69b88a9..246de1152 100644 --- a/builder/azure/arm/tempname.go +++ b/builder/azure/arm/tempname.go @@ -28,9 +28,10 @@ func NewTempName(p string) *TempName { suffix := random.AlphaNumLower(5) if p == "" { - p = "pkr" - suffix = random.AlphaNumLower(10) - } + p = "pkr" + suffix = random.AlphaNumLower(10) + } + tempName.ComputeName = fmt.Sprintf("%svm%s", p, suffix) tempName.DeploymentName = fmt.Sprintf("%sdp%s", p, suffix) tempName.KeyVaultName = fmt.Sprintf("%skv%s", p, suffix) diff --git a/builder/azure/arm/tempname_test.go b/builder/azure/arm/tempname_test.go index 538ed8edd..5f7711a82 100644 --- a/builder/azure/arm/tempname_test.go +++ b/builder/azure/arm/tempname_test.go @@ -30,8 +30,8 @@ func TestTempNameShouldCreatePrefixedRandomNames(t *testing.T) { t.Errorf("Expected PublicIPAddressName to begin with 'pkrip', but got '%s'!", tempName.PublicIPAddressName) } - if strings.Index(tempName.ResourceGroupName, "packer-Resource-Group-") != 0 { - t.Errorf("Expected ResourceGroupName to begin with 'packer-Resource-Group-', but got '%s'!", tempName.ResourceGroupName) + if strings.Index(tempName.ResourceGroupName, "pkr-Resource-Group-") != 0 { + t.Errorf("Expected ResourceGroupName to begin with 'pkr-Resource-Group-', but got '%s'!", tempName.ResourceGroupName) } if strings.Index(tempName.SubnetName, "pkrsn") != 0 {