diff --git a/plugin/etcd/setup.go b/plugin/etcd/setup.go index 4bce42a75..f753a0f1a 100644 --- a/plugin/etcd/setup.go +++ b/plugin/etcd/setup.go @@ -92,9 +92,6 @@ func etcdParse(c *caddy.Controller) (*Etcd, bool, error) { endpoints = args case "upstream": args := c.RemainingArgs() - if len(args) == 0 { - return nil, false, c.ArgErr() - } u, err := upstream.New(args) if err != nil { return nil, false, err diff --git a/plugin/etcd/setup_test.go b/plugin/etcd/setup_test.go index 517aeea54..620460cc1 100644 --- a/plugin/etcd/setup_test.go +++ b/plugin/etcd/setup_test.go @@ -30,6 +30,20 @@ func TestSetupEtcd(t *testing.T) { endpoint localhost:300 } `, false, "skydns", []string{"localhost:300"}, "", + }, + //test for upstream + { + `etcd { + endpoint localhost:300 + upstream 8.8.8.8:53 8.8.4.4:53 +}`, false, "skydns", []string{"localhost:300"}, "", + }, + //test for optional upstream address + { + `etcd { + endpoint localhost:300 + upstream +}`, false, "skydns", []string{"localhost:300"}, "", }, // negative {