Add azureusgovernment to environment list, fix Makefile (#695)

* Add azureusgovernment to environment list, fix Makefile

* add support for AZURECLOUD

Co-authored-by: Joel Hendrix <jhendrix@microsoft.com>
This commit is contained in:
rguptar 2022-04-21 11:58:16 -07:00 коммит произвёл GitHub
Родитель f9a841b5df
Коммит 7525a9bd00
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 35 добавлений и 24 удалений

Просмотреть файл

@ -1,23 +0,0 @@
DIR?=./autorest/
default: build
build: fmt
go install $(DIR)
test:
go test $(DIR) || exit 1
vet:
@echo "go vet ."
@go vet $(DIR)... ; if [ $$? -eq 1 ]; then \
echo ""; \
echo "Vet found suspicious constructs. Please check the reported constructs"; \
echo "and fix them if necessary before submitting the code for review."; \
exit 1; \
fi
fmt:
gofmt -w $(DIR)
.PHONY: build test vet fmt

17
Makefile Normal file
Просмотреть файл

@ -0,0 +1,17 @@
DIR?=./autorest/
default: build
build: fmt
cd $(DIR); go install
test:
cd $(DIR); go test -v
vet:
cd $(DIR); go vet
fmt:
gofmt -w $(DIR)
.PHONY: build test vet fmt

Просмотреть файл

@ -34,8 +34,10 @@ const (
var environments = map[string]Environment{
"AZURECHINACLOUD": ChinaCloud,
"AZUREGERMANCLOUD": GermanCloud,
"AZURECLOUD": PublicCloud,
"AZUREPUBLICCLOUD": PublicCloud,
"AZUREUSGOVERNMENTCLOUD": USGovernmentCloud,
"AZUREUSGOVERNMENT": USGovernmentCloud,
"AZUREUSGOVERNMENTCLOUD": USGovernmentCloud, //TODO: deprecate
}
// ResourceIdentifier contains a set of Azure resource IDs.

Просмотреть файл

@ -176,6 +176,11 @@ func TestEnvironmentFromName(t *testing.T) {
t.Errorf("Expected to get GermanCloud for %q", name)
}
name = "AzureCloud"
if env, _ := EnvironmentFromName(name); env != PublicCloud {
t.Errorf("Expected to get PublicCloud for %q", name)
}
name = "azurepubliccloud"
if env, _ := EnvironmentFromName(name); env != PublicCloud {
t.Errorf("Expected to get PublicCloud for %q", name)
@ -196,6 +201,16 @@ func TestEnvironmentFromName(t *testing.T) {
t.Errorf("Expected to get USGovernmentCloud for %q", name)
}
name = "azureusgovernment"
if env, _ := EnvironmentFromName(name); env != USGovernmentCloud {
t.Errorf("Expected to get USGovernmentCloud for %q", name)
}
name = "AzureUSGovernment"
if env, _ := EnvironmentFromName(name); env != USGovernmentCloud {
t.Errorf("Expected to get USGovernmentCloud for %q", name)
}
name = "thisisnotarealcloudenv"
if _, err := EnvironmentFromName(name); err == nil {
t.Errorf("Expected to get an error for %q", name)