2010-12-03 05:34:57 +01:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// TODO It would be nice to use a mock DNS server, to eliminate
|
|
|
|
// external dependencies.
|
|
|
|
|
|
|
|
package net
|
|
|
|
|
|
|
|
import (
|
2011-05-20 02:18:15 +02:00
|
|
|
"runtime"
|
2010-12-03 05:34:57 +01:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2011-05-20 02:18:15 +02:00
|
|
|
var avoidMacFirewall = runtime.GOOS == "darwin"
|
|
|
|
|
2010-12-03 05:34:57 +01:00
|
|
|
func TestGoogleSRV(t *testing.T) {
|
2011-05-20 02:18:15 +02:00
|
|
|
if testing.Short() || avoidMacFirewall {
|
|
|
|
t.Logf("skipping test to avoid external network")
|
|
|
|
return
|
|
|
|
}
|
2010-12-03 05:34:57 +01:00
|
|
|
_, addrs, err := LookupSRV("xmpp-server", "tcp", "google.com")
|
|
|
|
if err != nil {
|
|
|
|
t.Errorf("failed: %s", err)
|
|
|
|
}
|
|
|
|
if len(addrs) == 0 {
|
|
|
|
t.Errorf("no results")
|
|
|
|
}
|
|
|
|
}
|