Commit 1a01e13d authored by Jiacheng Xu's avatar Jiacheng Xu Committed by corbot[bot]

plugin/etcd: make the address of upstream optional (#2262)

Automatically submitted.
parent 05204ef1
...@@ -92,9 +92,6 @@ func etcdParse(c *caddy.Controller) (*Etcd, bool, error) { ...@@ -92,9 +92,6 @@ func etcdParse(c *caddy.Controller) (*Etcd, bool, error) {
endpoints = args endpoints = args
case "upstream": case "upstream":
args := c.RemainingArgs() args := c.RemainingArgs()
if len(args) == 0 {
return nil, false, c.ArgErr()
}
u, err := upstream.New(args) u, err := upstream.New(args)
if err != nil { if err != nil {
return nil, false, err return nil, false, err
......
...@@ -30,6 +30,20 @@ func TestSetupEtcd(t *testing.T) { ...@@ -30,6 +30,20 @@ func TestSetupEtcd(t *testing.T) {
endpoint localhost:300 endpoint localhost:300
} }
`, false, "skydns", []string{"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 // negative
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment