mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 12:10:24 +03:00
heal: Print heal command appropriately without export path. (#3208)
Fixes #3204
This commit is contained in:
@@ -18,9 +18,59 @@ package cmd
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Tests and validates the output for heal endpoint.
|
||||
func TestGetHealEndpoint(t *testing.T) {
|
||||
// Test for a SSL scheme.
|
||||
tls := true
|
||||
hURL := getHealEndpoint(tls, &url.URL{
|
||||
Scheme: "http",
|
||||
Host: "localhost:9000",
|
||||
})
|
||||
sHURL := &url.URL{
|
||||
Scheme: "https",
|
||||
Host: "localhost:9000",
|
||||
}
|
||||
if !reflect.DeepEqual(hURL, sHURL) {
|
||||
t.Fatalf("Expected %#v, but got %#v", sHURL, hURL)
|
||||
}
|
||||
|
||||
// Test a non-TLS scheme.
|
||||
tls = false
|
||||
hURL = getHealEndpoint(tls, &url.URL{
|
||||
Scheme: "https",
|
||||
Host: "localhost:9000",
|
||||
})
|
||||
sHURL = &url.URL{
|
||||
Scheme: "http",
|
||||
Host: "localhost:9000",
|
||||
}
|
||||
if !reflect.DeepEqual(hURL, sHURL) {
|
||||
t.Fatalf("Expected %#v, but got %#v", sHURL, hURL)
|
||||
}
|
||||
|
||||
// FIXME(GLOBAL): purposefully Host is left empty because
|
||||
// we need to bring in safe handling on global values
|
||||
// add a proper test case here once that happens.
|
||||
/*
|
||||
tls = false
|
||||
hURL = getHealEndpoint(tls, &url.URL{
|
||||
Path: "/export",
|
||||
})
|
||||
sHURL = &url.URL{
|
||||
Scheme: "http",
|
||||
Host: "",
|
||||
}
|
||||
globalMinioAddr = ""
|
||||
if !reflect.DeepEqual(hURL, sHURL) {
|
||||
t.Fatalf("Expected %#v, but got %#v", sHURL, hURL)
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// Tests heal message to be correct and properly formatted.
|
||||
func TestHealMsg(t *testing.T) {
|
||||
rootPath, err := newTestConfig("us-east-1")
|
||||
@@ -69,7 +119,7 @@ func TestHealMsg(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for i, testCase := range testCases {
|
||||
msg := getHealMsg(testCase.endPoints[0].String(), testCase.storageDisks)
|
||||
msg := getHealMsg(testCase.endPoints, testCase.storageDisks)
|
||||
if msg == "" {
|
||||
t.Fatalf("Test: %d Unable to get heal message.", i+1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user