aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorGravatar Jiacheng Xu <xjcmaxwellcjx@gmail.com> 2018-11-02 20:52:12 +0100
committerGravatar corbot[bot] <corbot[bot]@users.noreply.github.com> 2018-11-02 19:52:12 +0000
commit1a01e13db881d3b75cd31bf2a3564900d5b67d5b (patch)
treec9ad3654bdca1114ba992d3e6e96377d05004fc0 /plugin
parent05204ef14253de13c18b8442c2b04dd03345d98b (diff)
downloadcoredns-1a01e13db881d3b75cd31bf2a3564900d5b67d5b.tar.gz
coredns-1a01e13db881d3b75cd31bf2a3564900d5b67d5b.tar.zst
coredns-1a01e13db881d3b75cd31bf2a3564900d5b67d5b.zip
plugin/etcd: make the address of upstream optional (#2262)
Automatically submitted.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/etcd/setup.go3
-rw-r--r--plugin/etcd/setup_test.go14
2 files changed, 14 insertions, 3 deletions
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
@@ -31,6 +31,20 @@ func TestSetupEtcd(t *testing.T) {
}
`, 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
{
`etcd {