fix: --console-address when specified endpoints missing (#12534)

Additionally upgrade console dependency for reading
environment variables properly.
This commit is contained in:
Harshavardhana
2021-06-20 23:04:47 -07:00
committed by GitHub
parent e1870c7b7c
commit 8f1fe3b761
13 changed files with 87 additions and 53 deletions

View File

@@ -50,20 +50,20 @@ func TestStorageInfoMsg(t *testing.T) {
func TestStripStandardPorts(t *testing.T) {
apiEndpoints := []string{"http://127.0.0.1:9000", "http://127.0.0.2:80", "https://127.0.0.3:443"}
expectedAPIEndpoints := []string{"http://127.0.0.1:9000", "http://127.0.0.2", "https://127.0.0.3"}
newAPIEndpoints := stripStandardPorts(apiEndpoints)
newAPIEndpoints := stripStandardPorts(apiEndpoints, "")
if !reflect.DeepEqual(expectedAPIEndpoints, newAPIEndpoints) {
t.Fatalf("Expected %#v, got %#v", expectedAPIEndpoints, newAPIEndpoints)
}
apiEndpoints = []string{"http://%%%%%:9000"}
newAPIEndpoints = stripStandardPorts(apiEndpoints)
newAPIEndpoints = stripStandardPorts(apiEndpoints, "")
if !reflect.DeepEqual([]string{""}, newAPIEndpoints) {
t.Fatalf("Expected %#v, got %#v", apiEndpoints, newAPIEndpoints)
}
apiEndpoints = []string{"http://127.0.0.1:443", "https://127.0.0.1:80"}
newAPIEndpoints = stripStandardPorts(apiEndpoints)
newAPIEndpoints = stripStandardPorts(apiEndpoints, "")
if !reflect.DeepEqual(apiEndpoints, newAPIEndpoints) {
t.Fatalf("Expected %#v, got %#v", apiEndpoints, newAPIEndpoints)
}