mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
fix(plugin): prevent panic when ListenHosts is empty (#7565)
This commit is contained in:
24
test/bind_test.go
Normal file
24
test/bind_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package test
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestBind_FilterAll(t *testing.T) {
|
||||
t.Parallel()
|
||||
corefile := `.:0 {
|
||||
bind 127.0.0.1 {
|
||||
except 127.0.0.1
|
||||
}
|
||||
trace
|
||||
loop
|
||||
whoami
|
||||
}`
|
||||
inst, err := CoreDNSServer(corefile)
|
||||
if inst != nil {
|
||||
CoreDNSServerStop(inst)
|
||||
}
|
||||
if err == nil {
|
||||
t.Log("server started; stopping immediately")
|
||||
} else {
|
||||
t.Logf("server failed to start as expected without listeners: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user