mirror of
https://github.com/pgsty/minio.git
synced 2026-08-07 08:11:13 +03:00
Implement an offline mode for a distributed node (#4646)
Implement an offline mode for remote storage to cache the offline status of a node in order to prevent network calls that are bound to fail. After a time interval an attempt will be made to restore the connection and mark the node as online if successful. Fixes #4183
This commit is contained in:
committed by
Harshavardhana
parent
1978b9d8f9
commit
98b62cbec8
@@ -20,6 +20,7 @@ import (
|
||||
"bytes"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -423,3 +424,31 @@ func TestRetryStorage(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tests reply storage error transformation.
|
||||
func TestReplyStorageErr(t *testing.T) {
|
||||
unknownErr := errors.New("Unknown error")
|
||||
testCases := []struct {
|
||||
expectedErr error
|
||||
err error
|
||||
}{
|
||||
{
|
||||
expectedErr: errDiskNotFound,
|
||||
err: errDiskNotFoundFromNetError,
|
||||
},
|
||||
{
|
||||
expectedErr: errDiskNotFound,
|
||||
err: errDiskNotFoundFromRPCShutdown,
|
||||
},
|
||||
{
|
||||
expectedErr: unknownErr,
|
||||
err: unknownErr,
|
||||
},
|
||||
}
|
||||
for i, testCase := range testCases {
|
||||
resultErr := retryToStorageErr(testCase.err)
|
||||
if testCase.expectedErr != resultErr {
|
||||
t.Errorf("Test %d: Expected %s, got %s", i+1, testCase.expectedErr, resultErr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user