зеркало из https://github.com/Azure/go-autorest.git
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:
Родитель
f9a841b5df
Коммит
7525a9bd00
23
GNUmakefile
23
GNUmakefile
|
@ -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
|
|
@ -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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче