-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve validation check for Azure configuration (#20389)
A blob container name must be between 3 and 63 characters in length; start with a letter or number; and contain only letters, numbers, and the hyphen. All letters used in blob container names must be lowercase. Added validation to make sure the storage container name meets those requirements. Closes #20369
- Loading branch information
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
|
||
package azureeventhub | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestStorageContainerValidate(t *testing.T) { | ||
var tests = []struct { | ||
input string | ||
errIsNil bool | ||
}{ | ||
{"a-valid-name", true}, | ||
{"a", false}, | ||
{"a-name-that-is-really-too-long-to-be-valid-and-should-never-be-used-no-matter-what", false}, | ||
{"-not-valid", false}, | ||
{"capital-A-not-valid", false}, | ||
{"no_underscores_either", false}, | ||
} | ||
for _, test := range tests { | ||
err := storageContainerValidate(test.input) | ||
if (err == nil) != test.errIsNil { | ||
t.Errorf("storageContainerValidate(%s) = %v", test.input, err) | ||
} | ||
} | ||
} |