From ea77554dc41335caf6ccb638c0faf79df45a0c4f Mon Sep 17 00:00:00 2001 From: Matthias Rampke Date: Fri, 10 Nov 2017 14:04:28 +0000 Subject: [PATCH] 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 --- exporter_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exporter_test.go b/exporter_test.go index aa3c60f..7eeb4e1 100644 --- a/exporter_test.go +++ b/exporter_test.go @@ -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)) }