waf.Server held its parts as public fields only for the tests to read. The tests now keep the Params the server was built from in a test-only wafAndParts, which embeds both, so every assertion reads as before. newWAFWith takes a change to the Params instead of a build function, so the Params kept are the ones the server was built from. Model: opus-5-5
This commit is contained in:
1 parent
56a57125f1
commit
45252b7486
16 files changed
+81
-98
No files matched your search
@@ -57,7 +57,7 @@ type WAF struct {
|
||||
t *testing.T
|
||||
addr string
|
||||
out *output
|
||||
server *waf.Server
|
||||
server *wafAndParts
|
||||
clock *clock
|
||||
queue *alerts.Queue
|
||||
}
|
||||
@@ -69,14 +69,14 @@ func startWAF(
|
||||
) *WAF {
|
||||
t.Helper()
|
||||
|
||||
return startWAFWith(t, geojsURL, env, func(*waf.Server) {})
|
||||
return startWAFWith(t, geojsURL, env, func(*wafAndParts) {})
|
||||
}
|
||||
|
||||
// startWAFWith is startWAF with change applied to the server before
|
||||
// it starts.
|
||||
func startWAFWith(
|
||||
t *testing.T, geojsURL string, env map[string]string,
|
||||
change func(*waf.Server),
|
||||
change func(*wafAndParts),
|
||||
) *WAF {
|
||||
t.Helper()
|
||||
|
||||
@@ -663,7 +663,7 @@ func TestQuestionWhoseBodyStopsArrivingGetsNoAnswer(t *testing.T) {
|
||||
t,
|
||||
"",
|
||||
map[string]string{metricsToken: token},
|
||||
func(server *waf.Server) { server.ReadTimeout = readTimeout },
|
||||
func(server *wafAndParts) { server.ReadTimeout = readTimeout },
|
||||
)
|
||||
|
||||
conn := dial(t, s.addr)
|
||||
|
||||
Reference in new issue
Block a user