Browse Source

windows: fix test cases

Nicola Murino 6 years ago
parent
commit
e177366be9
2 changed files with 7 additions and 2 deletions
  1. 6 1
      sftpd/internal_test.go
  2. 1 1
      sftpd/sftpd_test.go

+ 6 - 1
sftpd/internal_test.go

@@ -1,14 +1,19 @@
 package sftpd
 package sftpd
 
 
 import (
 import (
+	"runtime"
 	"testing"
 	"testing"
 )
 )
 
 
 func TestWrongActions(t *testing.T) {
 func TestWrongActions(t *testing.T) {
 	actionsCopy := actions
 	actionsCopy := actions
+	badCommand := "/bad/command"
+	if runtime.GOOS == "windows" {
+		badCommand = "C:\\bad\\command"
+	}
 	actions = Actions{
 	actions = Actions{
 		ExecuteOn:           []string{operationDownload},
 		ExecuteOn:           []string{operationDownload},
-		Command:             "/bad/command",
+		Command:             badCommand,
 		HTTPNotificationURL: "",
 		HTTPNotificationURL: "",
 	}
 	}
 	err := executeAction(operationDownload, "username", "path", "")
 	err := executeAction(operationDownload, "username", "path", "")

+ 1 - 1
sftpd/sftpd_test.go

@@ -737,7 +737,7 @@ func TestBandwidthAndConnections(t *testing.T) {
 			t.Errorf("download bandwidth throttling not respected, elapsed: %v, wanted: %v", elapsed, wantedDownloadElapsed)
 			t.Errorf("download bandwidth throttling not respected, elapsed: %v, wanted: %v", elapsed, wantedDownloadElapsed)
 		}
 		}
 		// test disconnection
 		// test disconnection
-		c = sftpUploadNonBlocking(testFilePath, testFileName, testFileSize, client)
+		c = sftpUploadNonBlocking(testFilePath, testFileName+"_partial", testFileSize, client)
 		waitForActiveTransfer()
 		waitForActiveTransfer()
 		time.Sleep(100 * time.Millisecond)
 		time.Sleep(100 * time.Millisecond)
 		sftpd.CheckIdleConnections()
 		sftpd.CheckIdleConnections()