Core Rule Set tests: load each set of settings once (closes #252)
check / check (push) Failing after 1m32s
check / check (push) Failing after 1m32s
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
3093ed8f0d
commit
e07fb9f140
2 files changed
+79
-39
No files matched your search
@@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user