mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-08 15:28:05 +03:00
enable SCP test cases on Windows
This commit is contained in:
@@ -6546,13 +6546,14 @@ func TestSCPPermsSubDirs(t *testing.T) {
|
|||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
err = scpDownload(localPath, remoteDownPath, false, false)
|
err = scpDownload(localPath, remoteDownPath, false, false)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
err = os.Chmod(subPath, 0001)
|
if runtime.GOOS != osWindows {
|
||||||
assert.NoError(t, err)
|
err = os.Chmod(subPath, 0001)
|
||||||
err = scpDownload(localPath, remoteDownPath, false, false)
|
assert.NoError(t, err)
|
||||||
assert.Error(t, err, "download a file with no system permissions must fail")
|
err = scpDownload(localPath, remoteDownPath, false, false)
|
||||||
|
assert.Error(t, err, "download a file with no system permissions must fail")
|
||||||
err = os.Chmod(subPath, 0755)
|
err = os.Chmod(subPath, 0755)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
}
|
||||||
err = os.Remove(localPath)
|
err = os.Remove(localPath)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
err = os.RemoveAll(user.GetHomeDir())
|
err = os.RemoveAll(user.GetHomeDir())
|
||||||
@@ -6838,6 +6839,9 @@ func TestSCPRemoteToRemote(t *testing.T) {
|
|||||||
if len(scpPath) == 0 {
|
if len(scpPath) == 0 {
|
||||||
t.Skip("scp command not found, unable to execute this test")
|
t.Skip("scp command not found, unable to execute this test")
|
||||||
}
|
}
|
||||||
|
if runtime.GOOS == osWindows {
|
||||||
|
t.Skip("scp between remote hosts is not supported on Windows")
|
||||||
|
}
|
||||||
usePubKey := true
|
usePubKey := true
|
||||||
user, _, err := httpd.AddUser(getTestUser(usePubKey), http.StatusOK)
|
user, _, err := httpd.AddUser(getTestUser(usePubKey), http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
@@ -7381,15 +7385,11 @@ func checkSystemCommands() {
|
|||||||
logger.Warn(logSender, "", "unable to get hook command: %v", err)
|
logger.Warn(logSender, "", "unable to get hook command: %v", err)
|
||||||
logger.WarnToConsole("unable to get hook command: %v", err)
|
logger.WarnToConsole("unable to get hook command: %v", err)
|
||||||
}
|
}
|
||||||
if runtime.GOOS == osWindows {
|
scpPath, err = exec.LookPath("scp")
|
||||||
|
if err != nil {
|
||||||
|
logger.Warn(logSender, "", "unable to get scp command. SCP tests will be skipped, err: %v", err)
|
||||||
|
logger.WarnToConsole("unable to get scp command. SCP tests will be skipped, err: %v", err)
|
||||||
scpPath = ""
|
scpPath = ""
|
||||||
} else {
|
|
||||||
scpPath, err = exec.LookPath("scp")
|
|
||||||
if err != nil {
|
|
||||||
logger.Warn(logSender, "", "unable to get scp command. SCP tests will be skipped, err: %v", err)
|
|
||||||
logger.WarnToConsole("unable to get scp command. SCP tests will be skipped, err: %v", err)
|
|
||||||
scpPath = ""
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user