mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 12:10:24 +03:00
Use endpoint url when printing disks status in distributed mode (#3151)
This commit is contained in:
committed by
Harshavardhana
parent
226a69fe15
commit
79601d27f2
@@ -16,7 +16,10 @@
|
||||
|
||||
package cmd
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"net/url"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Tests heal message to be correct and properly formatted.
|
||||
func TestHealMsg(t *testing.T) {
|
||||
@@ -32,43 +35,48 @@ func TestHealMsg(t *testing.T) {
|
||||
nilDisks[5] = nil
|
||||
authErrs := make([]error, len(storageDisks))
|
||||
authErrs[5] = errAuthentication
|
||||
endpointURL, err := url.Parse("http://10.1.10.1:9000")
|
||||
if err != nil {
|
||||
t.Fatal("Unexpected error:", err)
|
||||
}
|
||||
endpointURLs := make([]*url.URL, len(storageDisks))
|
||||
for idx := 0; idx < len(endpointURLs); idx++ {
|
||||
endpointURLs[idx] = endpointURL
|
||||
}
|
||||
|
||||
testCases := []struct {
|
||||
endPoint string
|
||||
endPoints []*url.URL
|
||||
storageDisks []StorageAPI
|
||||
serrs []error
|
||||
}{
|
||||
// Test - 1 for valid disks and errors.
|
||||
{
|
||||
endPoint: "http://10.1.10.1:9000",
|
||||
endPoints: endpointURLs,
|
||||
storageDisks: storageDisks,
|
||||
serrs: errs,
|
||||
},
|
||||
// Test - 2 for one of the disks is nil.
|
||||
{
|
||||
endPoint: "http://10.1.10.1:9000",
|
||||
endPoints: endpointURLs,
|
||||
storageDisks: nilDisks,
|
||||
serrs: errs,
|
||||
},
|
||||
// Test - 3 for one of the errs is authentication.
|
||||
{
|
||||
endPoint: "http://10.1.10.1:9000",
|
||||
endPoints: endpointURLs,
|
||||
storageDisks: nilDisks,
|
||||
serrs: authErrs,
|
||||
},
|
||||
}
|
||||
for i, testCase := range testCases {
|
||||
msg := getHealMsg(testCase.endPoint, testCase.storageDisks)
|
||||
msg := getHealMsg(testCase.endPoints[0].String(), testCase.storageDisks)
|
||||
if msg == "" {
|
||||
t.Fatalf("Test: %d Unable to get heal message.", i+1)
|
||||
}
|
||||
msg = getRegularMsg(testCase.storageDisks)
|
||||
msg = getStorageInitMsg("init", testCase.endPoints, testCase.storageDisks)
|
||||
if msg == "" {
|
||||
t.Fatalf("Test: %d Unable to get regular message.", i+1)
|
||||
}
|
||||
msg = getFormatMsg(testCase.storageDisks)
|
||||
if msg == "" {
|
||||
t.Fatalf("Test: %d Unable to get format message.", i+1)
|
||||
}
|
||||
msg = getConfigErrMsg(testCase.storageDisks, testCase.serrs)
|
||||
if msg == "" {
|
||||
t.Fatalf("Test: %d Unable to get config error message.", i+1)
|
||||
|
||||
Reference in New Issue
Block a user