mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 22:23:48 +03:00
caddytest: Revise sleep durations
Attempt to reduce flakiness a bit more Test suite needs to be rewritten.
This commit is contained in:
parent
e4fac1294f
commit
e07a267276
3 changed files with 6 additions and 4 deletions
|
@ -214,7 +214,7 @@ func (tc *Tester) ensureConfigRunning(rawConfig string, configType string) error
|
||||||
return actual
|
return actual
|
||||||
}
|
}
|
||||||
|
|
||||||
for retries := 4; retries > 0; retries-- {
|
for retries := 10; retries > 0; retries-- {
|
||||||
if reflect.DeepEqual(expected, fetchConfig(client)) {
|
if reflect.DeepEqual(expected, fetchConfig(client)) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ func validateTestPrerequisites() error {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// wait for caddy to start serving the initial config
|
// wait for caddy to start serving the initial config
|
||||||
for retries := 4; retries > 0 && isCaddyAdminRunning() != nil; retries-- {
|
for retries := 10; retries > 0 && isCaddyAdminRunning() != nil; retries-- {
|
||||||
time.Sleep(10 * time.Millisecond)
|
time.Sleep(10 * time.Millisecond)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/caddyserver/caddy/v2/caddytest"
|
"github.com/caddyserver/caddy/v2/caddytest"
|
||||||
)
|
)
|
||||||
|
@ -441,6 +442,7 @@ func TestReverseProxyHealthCheck(t *testing.T) {
|
||||||
}
|
}
|
||||||
`, "caddyfile")
|
`, "caddyfile")
|
||||||
|
|
||||||
|
time.Sleep(100 * time.Millisecond) // TODO: for some reason this test seems particularly flaky, getting 503 when it should be 200, unless we wait
|
||||||
tester.AssertGetResponse("http://localhost:9080/", 200, "Hello, World!")
|
tester.AssertGetResponse("http://localhost:9080/", 200, "Hello, World!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ func sendFcgi(reqType int, fcgiParams map[string]string, data []byte, posts map[
|
||||||
|
|
||||||
log.Println("c: send data length ≈", length, string(content))
|
log.Println("c: send data length ≈", length, string(content))
|
||||||
conn.Close()
|
conn.Close()
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(250 * time.Millisecond)
|
||||||
|
|
||||||
if bytes.Contains(content, []byte("FAILED")) {
|
if bytes.Contains(content, []byte("FAILED")) {
|
||||||
globalt.Error("Server return failed message")
|
globalt.Error("Server return failed message")
|
||||||
|
@ -230,7 +230,7 @@ func DisabledTest(t *testing.T) {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(250 * time.Millisecond)
|
||||||
|
|
||||||
// init
|
// init
|
||||||
fcgiParams := make(map[string]string)
|
fcgiParams := make(map[string]string)
|
||||||
|
|
Loading…
Reference in a new issue