better handling of test multicast listener initialisation errors

We handle that error explicitly in all cases and point out the common
cause, namely the absence of a default multicast interface.

Closes #481.
This commit is contained in:
Matthias Radestock committed 2015-04-11 20:22:41 +01:00
1 parent bb99b21248
commit e0bba10ead
3 files changed
+23 -13

No files matched your search

+10 -3
View File
@@ -22,12 +22,19 @@ var (
testPort = 17625
)
func setupForTest() {
func setupForTest(t *testing.T) {
// fail early if we cannot find a default multicast interface
multicast, err := LinkLocalMulticastListener(nil)
if err != nil {
t.Fatalf("Unable to create multicast listener: %s. No default multicast interface?", err)
}
multicast.Close()
testPort++
}
func TestUDPDNSServer(t *testing.T) {
setupForTest()
setupForTest(t)
const (
successTestName = "test1.weave.local."
failTestName = "test2.weave.local."
@@ -110,7 +117,7 @@ func TestUDPDNSServer(t *testing.T) {
}
func TestTCPDNSServer(t *testing.T) {
setupForTest()
setupForTest(t)
const (
numAnswers = 512
nonLocalName = "weave.works."