Fixup timeout test
@@ -32,7 +32,7 @@ import (
func TestBackend_RoundTrip_Timings(t *testing.T) {
origin := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
if req.Method == http.MethodHead {
- time.Sleep(time.Second * 2) // > ttfb proxy settings
+ time.Sleep(time.Second * 2) // > ttfb and overall timeout
}
rw.WriteHeader(http.StatusNoContent)
}))
@@ -46,7 +46,7 @@ func TestBackend_RoundTrip_Timings(t *testing.T) {
expectedErr string
}{
{"with zero timings", test.NewRemainContext("origin", origin.URL), &transport.Config{}, httptest.NewRequest(http.MethodGet, "http://1.2.3.4/", nil), ""},
- {"with overall timeout", test.NewRemainContext("origin", "http://blackhole.webpagetest.org"), &transport.Config{Timeout: time.Second / 2}, httptest.NewRequest(http.MethodGet, "http://1.2.3.5/", nil), "context deadline exceeded"},
+ {"with overall timeout", test.NewRemainContext("origin", origin.URL), &transport.Config{Timeout: time.Second / 2, ConnectTimeout: time.Minute}, httptest.NewRequest(http.MethodHead, "http://1.2.3.5/", nil), "context deadline exceeded"},
{"with connect timeout", test.NewRemainContext("origin", "http://blackhole.webpagetest.org"), &transport.Config{ConnectTimeout: time.Second / 2}, httptest.NewRequest(http.MethodGet, "http://1.2.3.6/", nil), "i/o timeout"},
{"with ttfb timeout", test.NewRemainContext("origin", origin.URL), &transport.Config{TTFBTimeout: time.Second}, httptest.NewRequest(http.MethodHead, "http://1.2.3.7/", nil), "timeout awaiting response headers"},
}
