Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 09:15 UTC
caddytest: Revise sleep durations
Attempt to reduce flakiness a bit more Test suite needs to be rewritten.
Matthew Holt committed
Oct 5, 2022 at 11:40 UTC
e07a267276b9c00181c979ec65f26e25b8325beb
3 files changed
+6
-4
caddytest/caddytest.go
+2
-2
@@ -214,7 +214,7 @@ func (tc *Tester) ensureConfigRunning(rawConfig string, configType string) error
214
return actual
215
}
216
217
- for retries := 4; retries > 0; retries-- {
217
+ for retries := 10; retries > 0; retries-- {
218
if reflect.DeepEqual(expected, fetchConfig(client)) {
219
return nil
220
}
@@ -243,7 +243,7 @@ func validateTestPrerequisites() error {
243
}()
244
245
// wait for caddy to start serving the initial config
246
- for retries := 4; retries > 0 && isCaddyAdminRunning() != nil; retries-- {
246
+ for retries := 10; retries > 0 && isCaddyAdminRunning() != nil; retries-- {
247
time.Sleep(10 * time.Millisecond)
248
}
249
}
caddytest/integration/reverseproxy_test.go
+2
@@ -8,6 +8,7 @@ import (
8
"runtime"
9
"strings"
10
"testing"
11
+ "time"
12
13
"github.com/caddyserver/caddy/v2/caddytest"
14
)
@@ -441,6 +442,7 @@ func TestReverseProxyHealthCheck(t *testing.T) {
442
}
443
`, "caddyfile")
444
445
+ time.Sleep(100 * time.Millisecond) // TODO: for some reason this test seems particularly flaky, getting 503 when it should be 200, unless we wait
446
tester.AssertGetResponse("http://localhost:9080/", 200, "Hello, World!")
447
}
448
modules/caddyhttp/reverseproxy/fastcgi/client_test.go
+2
-2
@@ -171,7 +171,7 @@ func sendFcgi(reqType int, fcgiParams map[string]string, data []byte, posts map[
171
172
log.Println("c: send data length ≈", length, string(content))
173
conn.Close()
174
- time.Sleep(1 * time.Second)
174
+ time.Sleep(250 * time.Millisecond)
175
176
if bytes.Contains(content, []byte("FAILED")) {
177
globalt.Error("Server return failed message")
@@ -230,7 +230,7 @@ func DisabledTest(t *testing.T) {
230
}
231
}()
232
233
- time.Sleep(1 * time.Second)
233
+ time.Sleep(250 * time.Millisecond)
234
235
// init
236
fcgiParams := make(map[string]string)