mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 10:13:14 -04:00 
			
		
		
		
	The error propagation from srv.ListenAndServe did not work as intended, simplified it a bit and added a test for it.
		
			
				
	
	
		
			22 lines
		
	
	
		
			349 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			349 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 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")
 | |
| 	}
 | |
| }
 |