mirror of
https://github.com/coredns/coredns.git
synced 2026-07-10 17:50:12 -04:00
plugin/erratic: apply default truncate amount of 2 for bare truncate (#8240)
This commit is contained in:
@@ -86,6 +86,8 @@ func parseErratic(c *caddy.Controller) (*Erratic, error) {
|
|||||||
return nil, c.ArgErr()
|
return nil, c.ArgErr()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Defaults.
|
||||||
|
e.truncate = 2
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ func TestParseErratic(t *testing.T) {
|
|||||||
drop 3
|
drop 3
|
||||||
delay
|
delay
|
||||||
}`, false, 3, 2, 0},
|
}`, false, 3, 2, 0},
|
||||||
|
{`erratic {
|
||||||
|
drop 3
|
||||||
|
truncate
|
||||||
|
}`, false, 3, 0, 2},
|
||||||
// fails
|
// fails
|
||||||
{`erratic {
|
{`erratic {
|
||||||
drop -1
|
drop -1
|
||||||
|
|||||||
Reference in New Issue
Block a user