fix(test): Increase waiting for network time (#13613)
This commit is contained in:
parent
b6c1f3e487
commit
cd1932f031
|
|
@ -302,7 +302,7 @@ func (c *Container) setupRepo() error {
|
||||||
|
|
||||||
// Wait for the network to come up on a container
|
// Wait for the network to come up on a container
|
||||||
func (c *Container) waitForNetwork() error {
|
func (c *Container) waitForNetwork() error {
|
||||||
var exponentialBackoffCeilingSecs int64 = 16
|
var exponentialBackoffCeilingSecs int64 = 128
|
||||||
|
|
||||||
attempts := 0
|
attempts := 0
|
||||||
for {
|
for {
|
||||||
|
|
@ -310,12 +310,13 @@ func (c *Container) waitForNetwork() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// uses exponetnial backoff to try after 1, 2, 4, 8, and 16 seconds
|
// uses exponetnial backoff to try after 1, 2, 4, 8, 16, etc. seconds
|
||||||
delaySecs := int64(math.Pow(2, float64(attempts)))
|
delaySecs := int64(math.Pow(2, float64(attempts)))
|
||||||
if delaySecs > exponentialBackoffCeilingSecs {
|
if delaySecs > exponentialBackoffCeilingSecs {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Printf("waiting for network, sleeping for %d second(s)\n", delaySecs)
|
||||||
time.Sleep(time.Duration(delaySecs) * time.Second)
|
time.Sleep(time.Duration(delaySecs) * time.Second)
|
||||||
attempts++
|
attempts++
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue