tests: Fix one multi-delete test failure in Windows CI (#9602)

There is a disparency of behavior under Linux & Windows about
the returned error when trying to rename a non existant path.

err := os.Rename("/path/does/not/exist", "/tmp/copy")

Linux:
  isSysErrNotDir(err) = false
  os.IsNotExist(err) = true

Windows:
  isSysErrNotDir(err) = true
  os.IsNotExist(err) = true

ENOTDIR in Linux is returned when the destination path
of the rename call contains a file in one of the middle
segments of the path (e.g. /tmp/file/dst, where /tmp/file
is an actual file not a directory)

However, as shown above, Windows has more scenarios when
it returns ENOTDIR. For example, when the source path contains
an inexistant directory in its path.

In that case, we want errFileNotFound returned and not
errFileAccessDenied, so this commit will add a further check to close
the disparency between Windows & Linux.
This commit is contained in:
Anis Elleuch
2020-05-15 02:09:30 +01:00
committed by GitHub
parent 6c1bbf918d
commit f44a960dcd
2 changed files with 5 additions and 5 deletions

View File

@@ -28,7 +28,6 @@ import (
"net/http"
"net/url"
"reflect"
"runtime"
"strings"
"sync"
"testing"
@@ -121,9 +120,6 @@ func runAllTests(suite *TestSuiteCommon, c *check) {
}
func TestServerSuite(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("cannot set up server reliably on Windows")
}
testCases := []*TestSuiteCommon{
// Init and run test on FS backend with signature v4.
{serverType: "FS", signer: signerV4},