"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
tests: make test servers choose a random port to make more reliable
Nick Craig-Wood9df322e889c2
diff --git a/cmd/serve/dlna/dlna_test.go b/cmd/serve/dlna/dlna_test.goindex 577eda4a3..25091a4b6 100644--- a/cmd/serve/dlna/dlna_test.go+++ b/cmd/serve/dlna/dlna_test.go@@ -20,11 +20,11 @@ import (var (dlnaServer *server+ testURL string)const (- testBindAddress = "localhost:51777"- testURL = "http://" + testBindAddress + "/"+ testBindAddress = "localhost:0")func startServer(t *testing.T, f fs.Fs) {@@ -32,6 +32,7 @@ func startServer(t *testing.T, f fs.Fs) {opt.ListenAddr = testBindAddressdlnaServer = newServer(f, &opt)assert.NoError(t, dlnaServer.Serve())+ testURL = "http://" + dlnaServer.HTTPConn.Addr().String() + "/"}func TestInit(t *testing.T) {diff --git a/cmd/serve/http/http_test.go b/cmd/serve/http/http_test.goindex 984348d1d..e43aeed3b 100644--- a/cmd/serve/http/http_test.go+++ b/cmd/serve/http/http_test.go@@ -3,7 +3,6 @@ package httpimport ("flag""io/ioutil"- "net""net/http""strings""testing"@@ -21,11 +20,11 @@ import (var (updateGolden = flag.Bool("updategolden", false, "update golden files for regression test")httpServer *server+ testURL string)const (- testBindAddress = "localhost:51777"- testURL = "http://" + testBindAddress + "/"+ testBindAddress = "localhost:0")func startServer(t *testing.T, f fs.Fs) {@@ -33,13 +32,14 @@ func startServer(t *testing.T, f fs.Fs) {opt.ListenAddr = testBindAddresshttpServer = newServer(f, &opt)assert.NoError(t, httpServer.Serve())+ testURL = httpServer.Server.URL()// try to connect to the test serverpause := time.Millisecondfor i := 0; i < 10; i++ {- conn, err := net.Dial("tcp", testBindAddress)+ resp, err := http.Head(testURL)if err == nil {- _ = conn.Close()+ _ = resp.Body.Close()return}// t.Logf("couldn't connect, sleeping for %v: %v", pause, err)diff --git a/cmd/serve/restic/restic_test.go b/cmd/serve/restic/restic_test.goindex d139f6ea3..dfdb8f132 100644--- a/cmd/serve/restic/restic_test.go+++ b/cmd/serve/restic/restic_test.go@@ -17,8 +17,7 @@ import ()const (- testBindAddress = "localhost:51779"- testURL = "http://" + testBindAddress + "/"+ testBindAddress = "localhost:0"resticSource = "../../../../../restic/restic")@@ -62,7 +61,7 @@ func TestRestic(t *testing.T) {}cmd := exec.Command("go", args...)cmd.Env = append(os.Environ(),- "RESTIC_TEST_REST_REPOSITORY=rest:"+testURL+path,+ "RESTIC_TEST_REST_REPOSITORY=rest:"+w.Server.URL()+path,)out, err := cmd.CombinedOutput()if len(out) != 0 {diff --git a/cmd/serve/webdav/webdav_test.go b/cmd/serve/webdav/webdav_test.goindex eb2196fa3..0f74a5356 100644--- a/cmd/serve/webdav/webdav_test.go+++ b/cmd/serve/webdav/webdav_test.go@@ -20,8 +20,7 @@ import ()const (- testBindAddress = "localhost:51778"- testURL = "http://" + testBindAddress + "/"+ testBindAddress = "localhost:0")// check interfaces@@ -70,7 +69,7 @@ func TestWebDav(t *testing.T) {cmd := exec.Command("go", args...)cmd.Env = append(os.Environ(),"RCLONE_CONFIG_WEBDAVTEST_TYPE=webdav",- "RCLONE_CONFIG_WEBDAVTEST_URL="+testURL,+ "RCLONE_CONFIG_WEBDAVTEST_URL="+w.Server.URL(),"RCLONE_CONFIG_WEBDAVTEST_VENDOR=other",)out, err := cmd.CombinedOutput()diff --git a/fs/rc/rcserver/rcserver_test.go b/fs/rc/rcserver/rcserver_test.goindex 54af53711..287c865f0 100644--- a/fs/rc/rcserver/rcserver_test.go+++ b/fs/rc/rcserver/rcserver_test.go@@ -18,8 +18,7 @@ import ()const (- testBindAddress = "localhost:51781"- testURL = "http://" + testBindAddress + "/"+ testBindAddress = "localhost:0"testFs = "testdata/files"remoteURL = "[" + testFs + "]/" // initial URL path to fetch from that remote)@@ -39,6 +38,7 @@ func TestRcServer(t *testing.T) {rcServer.Close()rcServer.Wait()}()+ testURL := rcServer.Server.URL()// Do the simplest possible test to check the server is alive// Do it a few times to wait for the server to start