plugin/erratic: apply default truncate amount of 2 for bare truncate (#8240)

This commit is contained in:
SEONGHYUN HONG
2026-07-08 21:37:33 +09:00
committed by GitHub
parent e81066b3e4
commit b1a0d2f287
2 changed files with 6 additions and 0 deletions

View File

@@ -86,6 +86,8 @@ func parseErratic(c *caddy.Controller) (*Erratic, error) {
return nil, c.ArgErr()
}
// Defaults.
e.truncate = 2
if len(args) == 0 {
continue
}

View File

@@ -51,6 +51,10 @@ func TestParseErratic(t *testing.T) {
drop 3
delay
}`, false, 3, 2, 0},
{`erratic {
drop 3
truncate
}`, false, 3, 0, 2},
// fails
{`erratic {
drop -1