mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 22:30:56 +03:00
improve transfer error log and TestSCPErrors
This commit is contained in:
@@ -2003,8 +2003,6 @@ func TestSCPErrors(t *testing.T) {
|
||||
t.Skip("scp command not found, unable to execute this test")
|
||||
}
|
||||
u := getTestUser(true)
|
||||
u.UploadBandwidth = 4096
|
||||
u.DownloadBandwidth = 4096
|
||||
user, _, err := api.AddUser(u, http.StatusOK)
|
||||
if err != nil {
|
||||
t.Errorf("unable to add user: %v", err)
|
||||
@@ -2023,6 +2021,12 @@ func TestSCPErrors(t *testing.T) {
|
||||
if err != nil {
|
||||
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)
|
||||
go func() {
|
||||
if cmd.Run() == nil {
|
||||
|
||||
@@ -40,7 +40,7 @@ type Transfer struct {
|
||||
// For example network or client issues
|
||||
func (t *Transfer) TransferError(err error) {
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user