mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
fix build failure for go1.9 (#4872)
This commit is contained in:
parent
0b546ddfd4
commit
d8a11c8f4b
@ -27,4 +27,5 @@ after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
go:
|
||||
- 1.9.x
|
||||
- 1.8.x
|
||||
|
@ -12,7 +12,7 @@ clone_folder: c:\gopath\src\github.com\minio\minio
|
||||
# Environment variables
|
||||
environment:
|
||||
GOPATH: c:\gopath
|
||||
GOROOT: c:\go18
|
||||
GOROOT: c:\go
|
||||
|
||||
# scripts that run after cloning repository
|
||||
install:
|
||||
|
@ -1016,43 +1016,23 @@ func TestPosixReadFile(t *testing.T) {
|
||||
[]byte("world"),
|
||||
io.ErrUnexpectedEOF,
|
||||
},
|
||||
// Seeking into a wrong offset, return PathError. - 11
|
||||
{
|
||||
volume, "myobject",
|
||||
-1, 5,
|
||||
nil,
|
||||
func() error {
|
||||
if runtime.GOOS == globalWindowsOSName {
|
||||
return &os.PathError{
|
||||
Op: "read",
|
||||
Path: slashpath.Join(path, "success-vol", "myobject"),
|
||||
Err: syscall.Errno(0x57), // invalid parameter
|
||||
}
|
||||
}
|
||||
return &os.PathError{
|
||||
Op: "read",
|
||||
Path: slashpath.Join(path, "success-vol", "myobject"),
|
||||
Err: os.ErrInvalid,
|
||||
}
|
||||
}(),
|
||||
},
|
||||
// Seeking ahead returns io.EOF. - 12
|
||||
// Seeking ahead returns io.EOF. - 11
|
||||
{
|
||||
volume, "myobject", 14, 1, nil, io.EOF,
|
||||
},
|
||||
// Empty volume name. - 13
|
||||
// Empty volume name. - 12
|
||||
{
|
||||
"", "myobject", 14, 1, nil, errInvalidArgument,
|
||||
},
|
||||
// Empty filename name. - 14
|
||||
// Empty filename name. - 13
|
||||
{
|
||||
volume, "", 14, 1, nil, errIsNotRegular,
|
||||
},
|
||||
// Non existent volume name - 15.
|
||||
// Non existent volume name - 14.
|
||||
{
|
||||
"abcd", "", 14, 1, nil, errVolumeNotFound,
|
||||
},
|
||||
// Non existent filename - 16.
|
||||
// Non existent filename - 15.
|
||||
{
|
||||
volume, "abcd", 14, 1, nil, errFileNotFound,
|
||||
},
|
||||
@ -1069,6 +1049,24 @@ func TestPosixReadFile(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check PathError specially.
|
||||
{
|
||||
buf := make([]byte, 5)
|
||||
if _, err = posixStorage.ReadFile(volume, "myobject", -1, buf, nil); err != nil {
|
||||
isPathError := false
|
||||
switch err.(type) {
|
||||
case *os.PathError:
|
||||
isPathError = true
|
||||
}
|
||||
|
||||
if !isPathError {
|
||||
t.Fatalf("expected: <os.PathError>, got: %v", err)
|
||||
}
|
||||
} else {
|
||||
t.Fatalf("expected: <os.PathError>, got: <nil>")
|
||||
}
|
||||
}
|
||||
|
||||
// Following block validates all ReadFile test cases.
|
||||
for i, testCase := range testCases {
|
||||
var n int64
|
||||
|
Loading…
Reference in New Issue
Block a user