mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-22 07:30:25 +00:00
fix test cases on Windows
We have to rework TestRelativePaths and TestResolvePaths if we want to run them for Cloud Storage on Windows too: we use filesystem path while Cloud Storage providers expect Unix paths. On Windows is important to check the local filesystem so skip Cloud Storage providers test cases for now
This commit is contained in:
parent
bcaf283c35
commit
c64c080159
1 changed files with 9 additions and 4 deletions
|
@ -3044,7 +3044,9 @@ func TestRelativePaths(t *testing.T) {
|
|||
KeyPrefix: keyPrefix,
|
||||
}
|
||||
gcsfs, _ := vfs.NewGCSFs("", user.GetHomeDir(), gcsConfig)
|
||||
filesystems = append(filesystems, s3fs, gcsfs)
|
||||
if runtime.GOOS != "windows" {
|
||||
filesystems = append(filesystems, s3fs, gcsfs)
|
||||
}
|
||||
for _, fs := range filesystems {
|
||||
path = filepath.Join(user.HomeDir, "/")
|
||||
rel = fs.GetRelativePath(path)
|
||||
|
@ -3104,16 +3106,19 @@ func TestResolvePaths(t *testing.T) {
|
|||
var path, resolved string
|
||||
var err error
|
||||
filesystems := []vfs.Fs{vfs.NewOsFs("", user.GetHomeDir())}
|
||||
keyPrefix := strings.TrimPrefix(user.GetHomeDir(), "/") + "/"
|
||||
s3config := vfs.S3FsConfig{
|
||||
KeyPrefix: strings.TrimPrefix(user.GetHomeDir(), "/") + "/",
|
||||
KeyPrefix: keyPrefix,
|
||||
}
|
||||
os.MkdirAll(user.GetHomeDir(), 0777)
|
||||
s3fs, _ := vfs.NewS3Fs("", user.GetHomeDir(), s3config)
|
||||
gcsConfig := vfs.GCSFsConfig{
|
||||
KeyPrefix: strings.TrimPrefix(user.GetHomeDir(), "/") + "/",
|
||||
KeyPrefix: keyPrefix,
|
||||
}
|
||||
gcsfs, _ := vfs.NewGCSFs("", user.GetHomeDir(), gcsConfig)
|
||||
filesystems = append(filesystems, s3fs, gcsfs)
|
||||
if runtime.GOOS != "windows" {
|
||||
filesystems = append(filesystems, s3fs, gcsfs)
|
||||
}
|
||||
for _, fs := range filesystems {
|
||||
path = "/"
|
||||
resolved, _ = fs.ResolvePath(filepath.ToSlash(path))
|
||||
|
|
Loading…
Reference in a new issue