mirror of
https://github.com/coredns/coredns.git
synced 2026-08-20 23:08:28 -04:00
plugin/tls: manage certificates with ACME DNS-01 (#8310)
* plugin/tls: add automatic ACME certificates Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com> * chore: add houyuwushang to CODEOWNERS Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com> * chore: regenerate maintainer owners Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com> --------- Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/coredns/caddy"
|
||||
"github.com/coredns/coredns/plugin"
|
||||
)
|
||||
|
||||
func TestKeyForConfig(t *testing.T) {
|
||||
@@ -65,3 +66,26 @@ func TestGetConfig(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestAddPluginToAllServerBlocks(t *testing.T) {
|
||||
c := caddy.NewTestController("dns", "")
|
||||
ctx := c.Context().(*dnsContext)
|
||||
first := &Config{}
|
||||
secondZone := &Config{firstConfigInBlock: first}
|
||||
third := &Config{}
|
||||
first.firstConfigInBlock = first
|
||||
third.firstConfigInBlock = third
|
||||
ctx.configs = []*Config{first, secondZone, third}
|
||||
|
||||
AddPluginToAllServerBlocks(c, func(next plugin.Handler) plugin.Handler { return next })
|
||||
|
||||
if got := len(first.Plugin); got != 1 {
|
||||
t.Fatalf("first server block has %d plugins, want 1", got)
|
||||
}
|
||||
if got := len(secondZone.Plugin); got != 0 {
|
||||
t.Fatalf("secondary zone has %d plugins before propagation, want 0", got)
|
||||
}
|
||||
if got := len(third.Plugin); got != 1 {
|
||||
t.Fatalf("second server block has %d plugins, want 1", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user