sww: lift waf's check time limit and rproxy's wait in tests (closes #418)
check / check (push) Failing after 1m52s
check / check (push) Failing after 1m52s
Under heavy host load the sww tests got 503 where they expected 200 or 403: waf refused requests whose trap paths, rule files and Core Rule Set took longer than 500 ms, and rproxy gave up on waf after 2 s. waf.Params and sww.Params gain BesideLookupTimeLimit; zero keeps the 500 ms limit, so the binary is unchanged. The sww tests' run gives waf an hour, and startRProxy sets SWW_RPROXY_WAF_BACKEND_TIMEOUT_MS to 60000, as the rproxy package's tests do. waf's own tests set the limit through the new field instead of SetBesideLookupTimeLimit, which is gone. Model: opus-5-5
This commit was merged in pull request #422.
This commit is contained in:
1 parent
48edab5dad
commit
9cb8f362bc
7 files changed
+33
-22
No files matched your search
+10
-4
@@ -67,6 +67,9 @@ type Params struct {
|
||||
Viper *viper.Viper
|
||||
// Stdout receives the request log and the process's own messages.
|
||||
Stdout io.Writer
|
||||
// BesideLookupTimeLimit is the waf.Params.BesideLookupTimeLimit RunWAF
|
||||
// gives waf. Main leaves it zero, waf's own limit; tests lengthen it.
|
||||
BesideLookupTimeLimit time.Duration
|
||||
}
|
||||
|
||||
// Main runs the command os.Args names, and returns the process's exit status.
|
||||
@@ -146,7 +149,7 @@ func RunWAF(ctx context.Context, params Params) int {
|
||||
|
||||
return runWAFWithSettings(
|
||||
ctx,
|
||||
params.Version,
|
||||
params,
|
||||
cfg,
|
||||
stdout,
|
||||
remote,
|
||||
@@ -159,7 +162,7 @@ func RunWAF(ctx context.Context, params Params) int {
|
||||
// SWW_WAF_LOG_REMOTE_URL is set.
|
||||
func runWAFWithSettings(
|
||||
ctx context.Context,
|
||||
version string,
|
||||
params Params,
|
||||
cfg *config.WAF,
|
||||
stdout io.Writer,
|
||||
remote *remotelog.Sender,
|
||||
@@ -193,6 +196,7 @@ func runWAFWithSettings(
|
||||
ruleFiles,
|
||||
alertQueue,
|
||||
crs,
|
||||
params.BesideLookupTimeLimit,
|
||||
)
|
||||
if err != nil {
|
||||
return cannotStart(processLog, "cannot use the lookup database", err)
|
||||
@@ -221,7 +225,7 @@ func runWAFWithSettings(
|
||||
}
|
||||
|
||||
processLog.Info("starting",
|
||||
"version", version,
|
||||
"version", params.Version,
|
||||
"address", listener.Addr().String(),
|
||||
"settings", cfg)
|
||||
|
||||
@@ -249,7 +253,7 @@ func cannotStart(processLog *slog.Logger, message string, err error) int {
|
||||
func newServer(
|
||||
cfg *config.WAF, stdout io.Writer, processLog *slog.Logger,
|
||||
now func() time.Time, ruleFiles *rules.Files, alertQueue *alerts.Queue,
|
||||
crs *coreruleset.CoreRuleSet,
|
||||
crs *coreruleset.CoreRuleSet, besideLookupTimeLimit time.Duration,
|
||||
) (*waf.Server, error) {
|
||||
var lookupFile *lookup.File
|
||||
|
||||
@@ -278,6 +282,8 @@ func newServer(
|
||||
Now: now,
|
||||
Rules: ruleFiles,
|
||||
Alerts: alertQueue,
|
||||
|
||||
BesideLookupTimeLimit: besideLookupTimeLimit,
|
||||
})
|
||||
server.Metrics.AddAlerts(alertQueue)
|
||||
|
||||
|
||||
Reference in new issue
Block a user