Core Rule Set tests: load each set of settings once (closes #252)
check / check (push) Failing after 3m49s
check / check (push) Failing after 3m49s
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:
1 parent
3a37f82e34
commit
b2e84e034f
2 files changed
+89
-44
No files matched your search
@@ -34,18 +34,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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user