* Add reload directive * gofmt * Fix default jitter and error message * remove unneeded call to NextArg, add a couple negative setup tests * Review feedback
39 lines
940 B
Go
39 lines
940 B
Go
package reload
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/mholt/caddy"
|
|
)
|
|
|
|
func TestSetupReload(t *testing.T) {
|
|
c := caddy.NewTestController("dns", `reload`)
|
|
if err := setup(c); err != nil {
|
|
t.Fatalf("Expected no errors, but got: %v", err)
|
|
}
|
|
|
|
c = caddy.NewTestController("dns", `reload 10s`)
|
|
if err := setup(c); err != nil {
|
|
t.Fatalf("Expected no errors, but got: %v", err)
|
|
}
|
|
|
|
c = caddy.NewTestController("dns", `reload 10s 2s`)
|
|
if err := setup(c); err != nil {
|
|
t.Fatalf("Expected no errors, but got: %v", err)
|
|
}
|
|
|
|
c = caddy.NewTestController("dns", `reload foo`)
|
|
if err := setup(c); err == nil {
|
|
t.Fatalf("Expected errors, but got: %v", err)
|
|
}
|
|
|
|
c = caddy.NewTestController("dns", `reload 10s foo`)
|
|
if err := setup(c); err == nil {
|
|
t.Fatalf("Expected errors, but got: %v", err)
|
|
}
|
|
|
|
c = caddy.NewTestController("dns", `reload 10s 5s foo`)
|
|
if err := setup(c); err == nil {
|
|
t.Fatalf("Expected errors, but got: %v", err)
|
|
}
|
|
}
|