mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-22 07:30:25 +00:00
improve transfer error log and TestSCPErrors
This commit is contained in:
parent
bd0eb2f0a8
commit
f4507aeec2
2 changed files with 7 additions and 3 deletions
|
@ -2003,8 +2003,6 @@ func TestSCPErrors(t *testing.T) {
|
||||||
t.Skip("scp command not found, unable to execute this test")
|
t.Skip("scp command not found, unable to execute this test")
|
||||||
}
|
}
|
||||||
u := getTestUser(true)
|
u := getTestUser(true)
|
||||||
u.UploadBandwidth = 4096
|
|
||||||
u.DownloadBandwidth = 4096
|
|
||||||
user, _, err := api.AddUser(u, http.StatusOK)
|
user, _, err := api.AddUser(u, http.StatusOK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("unable to add user: %v", err)
|
t.Errorf("unable to add user: %v", err)
|
||||||
|
@ -2023,6 +2021,12 @@ func TestSCPErrors(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("error uploading file via scp: %v", err)
|
t.Errorf("error uploading file via scp: %v", err)
|
||||||
}
|
}
|
||||||
|
user.UploadBandwidth = 512
|
||||||
|
user.DownloadBandwidth = 512
|
||||||
|
_, _, err = api.UpdateUser(user, http.StatusOK)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("unable to update user: %v", err)
|
||||||
|
}
|
||||||
cmd := getScpDownloadCommand(localPath, remoteDownPath, false, false)
|
cmd := getScpDownloadCommand(localPath, remoteDownPath, false, false)
|
||||||
go func() {
|
go func() {
|
||||||
if cmd.Run() == nil {
|
if cmd.Run() == nil {
|
||||||
|
|
|
@ -40,7 +40,7 @@ type Transfer struct {
|
||||||
// For example network or client issues
|
// For example network or client issues
|
||||||
func (t *Transfer) TransferError(err error) {
|
func (t *Transfer) TransferError(err error) {
|
||||||
t.transferError = err
|
t.transferError = err
|
||||||
logger.Warn(logSender, t.connectionID, "Unexpected error for transfer, path: %#v, error: %#v bytes sent: %v, "+
|
logger.Warn(logSender, t.connectionID, "Unexpected error for transfer, path: %#v, error: \"%v\" bytes sent: %v, "+
|
||||||
"bytes received: %v", t.path, t.transferError, t.bytesSent, t.bytesReceived)
|
"bytes received: %v", t.path, t.transferError, t.bytesSent, t.bytesReceived)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue