Core Rule Set tests: load each set of settings once (closes #252)
check / check (push) Successful in 3m41s

Tests now share one Core Rule Set for each set of settings, loaded once
through sync.OnceValues in shared(). Exclusions-file tests and
TestCorazaWritesNoFile still load their own: loading is what they check.

Loading was not most of the time: the WordPress and Drupal recorded
requests, inspected one after another, were. Each recorded request now
runs as its own parallel subtest, with the same request and outcome.

Model: opus-5-5
This commit is contained in:
sneak committed 2026-11-09 21:27:35 +00:00
1 parent c0313f7b27
commit cde2f14535
2 files changed
+77 -39

No files matched your search

+14 -10
View File
@@ -21,18 +21,22 @@ func TestOrdinaryDrupalRequestsPass(t *testing.T) {
defaults, bodies := atDefaults(t), readingBodies(t)
for _, recorded := range recordedRequests(t, "drupal-requests.txt") {
r := request{recorded.Method, recorded.Target, recorded.Headers}
t.Run(recorded.Method+" "+recorded.Target, func(t *testing.T) {
t.Parallel()
got, _ := inspectBody(t, defaults, r, recorded.Body)
if got.Score >= drupalThreshold {
t.Errorf("%s %s refused: %+v", r.method, r.target, got)
}
r := request{recorded.Method, recorded.Target, recorded.Headers}
got, _ = inspectBody(t, bodies, r, recorded.Body)
if got.Score >= drupalThreshold {
t.Errorf("%s %s %.200q refused while bodies are read: %+v",
r.method, r.target, recorded.Body, got)
}
got, _ := inspectBody(t, defaults, r, recorded.Body)
if got.Score >= drupalThreshold {
t.Errorf("%s %s refused: %+v", r.method, r.target, got)
}
got, _ = inspectBody(t, bodies, r, recorded.Body)
if got.Score >= drupalThreshold {
t.Errorf("%s %s %.200q refused while bodies are read: %+v",
r.method, r.target, recorded.Body, got)
}
})
}
}