mirror of
https://github.com/rclone/rclone.git
synced 2025-08-19 01:46:31 +02:00
tests: make test servers choose a random port to make more reliable
Tests have been randomly failing with messages like listen tcp 127.0.0.1:51778: bind: address already in use Rework all the test servers so they choose a random free port on startup and use that for the tests to avoid.
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user