mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
Failed startup was not flagged (#118)
The error propagation from srv.ListenAndServe did not work as intended, simplified it a bit and added a test for it.
This commit is contained in:
21
test/fail_start_test.go
Normal file
21
test/fail_start_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/miekg/coredns/core"
|
||||
)
|
||||
|
||||
// Bind to low port should fail.
|
||||
func TestFailStartServer(t *testing.T) {
|
||||
corefile := `.:53 {
|
||||
chaos CoreDNS-001 miek@miek.nl
|
||||
}
|
||||
`
|
||||
srv, _ := core.TestServer(t, corefile)
|
||||
err := srv.ListenAndServe()
|
||||
if err == nil {
|
||||
srv.Stop()
|
||||
t.Fatalf("Low port startup should fail")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user