Force IPv4 for the mock TCP listener.

Travis CI [does not have IPv6][0] in any environment. It could be
[enabled][1] if we ran the build in a VM, but that is much slower to
start. Instead, we just force the test connection to use IPv4.

[0]: https://blog.travis-ci.com/2015-11-27-moving-to-a-more-elastic-future#ipv6-no-longer-present
[1]: https://github.com/travis-ci/travis-ci/issues/5200#issuecomment-162539556
This commit is contained in:
Matthias Rampke 2017-11-10 14:04:28 +00:00
parent 92702b80fd
commit ea77554dc4

View file

@ -124,7 +124,9 @@ type mockStatsDTCPListener struct {
}
func (ml *mockStatsDTCPListener) handlePacket(packet []byte, e chan<- Events) {
lc, err := net.ListenTCP("tcp", nil)
// Forcing IPv4 because the TravisCI build environment does not have IPv6
// addresses.
lc, err := net.ListenTCP("tcp4", nil)
if err != nil {
panic(fmt.Sprintf("mockStatsDTCPListener: listen failed: %v", err))
}