AWS_DEFAULT_REGION should have been checked as a backup to AWS_REGION, but wasn't. Also removed a redundant print statement in a test case.

Change-Id: I0de4bcd5a134f7a9af249e5ebe56dfc3d35abf6d
This commit is contained in:
Patrick Jones 2021-03-17 15:44:40 -07:00
parent 9bb904979d
commit 57bbf4f324
2 changed files with 2 additions and 2 deletions

View File

@ -341,6 +341,8 @@ func (cs awsCredentialSource) subjectToken() (string, error) {
func (cs *awsCredentialSource) getRegion() (string, error) {
if envAwsRegion := getenv("AWS_REGION"); envAwsRegion != "" {
return envAwsRegion, nil
} else if envAwsRegion := getenv("AWS_DEFAULT_REGION"); envAwsRegion != "" {
return envAwsRegion, nil
}
if cs.RegionURL == "" {

View File

@ -7,7 +7,6 @@ package externalaccount
import (
"context"
"encoding/json"
"fmt"
"net/http"
"net/http/httptest"
"testing"
@ -20,7 +19,6 @@ func TestRetrieveURLSubjectToken_Text(t *testing.T) {
if r.Method != "GET" {
t.Errorf("Unexpected request method, %v is found", r.Method)
}
fmt.Println(r.Header)
if r.Header.Get("Metadata") != "True" {
t.Errorf("Metadata header not properly included.")
}