Do several attempts to send the file

This commit is contained in:
Juan Font Alonso 2021-09-26 18:59:23 +02:00
parent 7d0da8b578
commit 5626f598ce

View file

@ -565,10 +565,22 @@ func (s *IntegrationTestSuite) TestTailDrop() {
// So curl! // So curl!
peerAPI, ok := apiURLs[ip] peerAPI, ok := apiURLs[ip]
assert.True(t, ok) assert.True(t, ok)
// We still have some issues with the test infrastructure, so
// lets run curl multiple times until it works.
attempts := 0
var err error
for {
command := []string{ command := []string{
"curl", "curl",
"--retry-connrefused",
"--retry-delay",
"30",
"--retry", "--retry",
"10", "10",
"--connect-timeout",
"60",
"-X", "-X",
"PUT", "PUT",
"--upload-file", "--upload-file",
@ -576,11 +588,21 @@ func (s *IntegrationTestSuite) TestTailDrop() {
fmt.Sprintf("%s/v0/put/file_from_%s", peerAPI, hostname), fmt.Sprintf("%s/v0/put/file_from_%s", peerAPI, hostname),
} }
fmt.Printf("Sending file from %s (%s) to %s (%s)\n", hostname, ips[hostname], peername, ip) fmt.Printf("Sending file from %s (%s) to %s (%s)\n", hostname, ips[hostname], peername, ip)
_, err := executeCommand( _, err = executeCommand(
&tailscale, &tailscale,
command, command,
[]string{"ALL_PROXY=socks5://localhost:1055/"}, []string{"ALL_PROXY=socks5://localhost:1055/"},
) )
if err == nil {
break
} else {
time.Sleep(10 * time.Second)
attempts++
if attempts > 10 {
break
}
}
}
assert.Nil(t, err) assert.Nil(t, err)
} }
}) })