From 45682dc090d36d323a3b63b0caa78e25bf328e86 Mon Sep 17 00:00:00 2001 From: davidadeleon <56207066+davidadeleon@users.noreply.github.com> Date: Fri, 21 Jun 2024 15:09:07 -0400 Subject: [PATCH] VAULT-28281: Pass in accountName variable into validation function (#27563) * pass in correct accountName variable into validation function * modify test fixture to better test validation functionality * pass in accountName variable into error message * changelog --- changelog/27563.txt | 3 +++ physical/azure/azure.go | 4 ++-- physical/azure/azure_test.go | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 changelog/27563.txt diff --git a/changelog/27563.txt b/changelog/27563.txt new file mode 100644 index 000000000000..294b5e7cf642 --- /dev/null +++ b/changelog/27563.txt @@ -0,0 +1,3 @@ +```release-note:bug +storage/azure: Fix invalid account name initialization bug +``` \ No newline at end of file diff --git a/physical/azure/azure.go b/physical/azure/azure.go index b655df8d3c6d..fc016e7fe93c 100644 --- a/physical/azure/azure.go +++ b/physical/azure/azure.go @@ -68,8 +68,8 @@ func NewAzureBackend(conf map[string]string, logger log.Logger) (physical.Backen return nil, fmt.Errorf("'accountName' must be set") } } - if err := validateAccountName(name); err != nil { - return nil, fmt.Errorf("invalid account name %s: %w", name, err) + if err := validateAccountName(accountName); err != nil { + return nil, fmt.Errorf("invalid account name %s: %w", accountName, err) } accountKey := os.Getenv("AZURE_ACCOUNT_KEY") diff --git a/physical/azure/azure_test.go b/physical/azure/azure_test.go index 22344a6bca2e..2e491bd9b886 100644 --- a/physical/azure/azure_test.go +++ b/physical/azure/azure_test.go @@ -35,7 +35,7 @@ func testFixture(t *testing.T) (*AzureBackend, func()) { t.Helper() ts := time.Now().UnixNano() - name := fmt.Sprintf("vlt%d", ts) + name := fmt.Sprintf("vlt-%d", ts) _ = os.Setenv("AZURE_BLOB_CONTAINER", name) cleanup := func() {}