In many situations, while testing we encounter ErrInternalError, to reduce logging we have removed logging from quite a few places which is acceptable but when ErrInternalError occurs we should have a facility to log the corresponding error, this helps to debug Minio server.
Showing the changes to cmd/api-errors_test.go (1 of 18 files). Show all
Unified · Split
| @@ -17,6 +17,7 @@ · 16 unmodified lines | |||
| 17 | package cmd | 17 | package cmd |
| 18 | 18 | ||
| 19 | import ( | 19 | import ( |
| 20 | "context" | ||
| 20 | "errors" | 21 | "errors" |
| 21 | "testing" | 22 | "testing" |
| 22 | 23 | ||
| @@ -64,8 +65,9 @@ var toAPIErrorCodeTests = []struct { · 41 unmodified lines | |||
| 64 | } | 65 | } |
| 65 | 66 | ||
| 66 | func TestAPIErrCode(t *testing.T) { | 67 | func TestAPIErrCode(t *testing.T) { |
| 68 | ctx := context.Background() | ||
| 67 | for i, testCase := range toAPIErrorCodeTests { | 69 | for i, testCase := range toAPIErrorCodeTests { |
| 68 | errCode := toAPIErrorCode(testCase.err) | 70 | errCode := toAPIErrorCode(ctx, testCase.err) |
| 69 | if errCode != testCase.errCode { | 71 | if errCode != testCase.errCode { |
| 70 | t.Errorf("Test %d: Expected error code %d, got %d", i+1, testCase.errCode, errCode) | 72 | t.Errorf("Test %d: Expected error code %d, got %d", i+1, testCase.errCode, errCode) |
| 71 | } | 73 | } |