Listen on localhost interface in tests (#3667)
This commit is contained in:
parent
b7b55d1806
commit
e226aa49c9
|
@ -114,7 +114,7 @@ var (
|
||||||
|
|
||||||
func newTestHTTPListener() *HTTPListener {
|
func newTestHTTPListener() *HTTPListener {
|
||||||
listener := &HTTPListener{
|
listener := &HTTPListener{
|
||||||
ServiceAddress: ":0",
|
ServiceAddress: "localhost:0",
|
||||||
}
|
}
|
||||||
return listener
|
return listener
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ func newTestHTTPSListener() *HTTPListener {
|
||||||
})
|
})
|
||||||
|
|
||||||
listener := &HTTPListener{
|
listener := &HTTPListener{
|
||||||
ServiceAddress: ":0",
|
ServiceAddress: "localhost:0",
|
||||||
TlsAllowedCacerts: allowedCAFiles,
|
TlsAllowedCacerts: allowedCAFiles,
|
||||||
TlsCert: serviceCertFile,
|
TlsCert: serviceCertFile,
|
||||||
TlsKey: serviceKeyFile,
|
TlsKey: serviceKeyFile,
|
||||||
|
@ -309,7 +309,7 @@ func TestWriteHTTPNoNewline(t *testing.T) {
|
||||||
|
|
||||||
func TestWriteHTTPMaxLineSizeIncrease(t *testing.T) {
|
func TestWriteHTTPMaxLineSizeIncrease(t *testing.T) {
|
||||||
listener := &HTTPListener{
|
listener := &HTTPListener{
|
||||||
ServiceAddress: ":0",
|
ServiceAddress: "localhost:0",
|
||||||
MaxLineSize: 128 * 1000,
|
MaxLineSize: 128 * 1000,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ func TestWriteHTTPMaxLineSizeIncrease(t *testing.T) {
|
||||||
|
|
||||||
func TestWriteHTTPVerySmallMaxBody(t *testing.T) {
|
func TestWriteHTTPVerySmallMaxBody(t *testing.T) {
|
||||||
listener := &HTTPListener{
|
listener := &HTTPListener{
|
||||||
ServiceAddress: ":0",
|
ServiceAddress: "localhost:0",
|
||||||
MaxBodySize: 4096,
|
MaxBodySize: 4096,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ func TestWriteHTTPVerySmallMaxBody(t *testing.T) {
|
||||||
|
|
||||||
func TestWriteHTTPVerySmallMaxLineSize(t *testing.T) {
|
func TestWriteHTTPVerySmallMaxLineSize(t *testing.T) {
|
||||||
listener := &HTTPListener{
|
listener := &HTTPListener{
|
||||||
ServiceAddress: ":0",
|
ServiceAddress: "localhost:0",
|
||||||
MaxLineSize: 70,
|
MaxLineSize: 70,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ func TestWriteHTTPVerySmallMaxLineSize(t *testing.T) {
|
||||||
|
|
||||||
func TestWriteHTTPLargeLinesSkipped(t *testing.T) {
|
func TestWriteHTTPLargeLinesSkipped(t *testing.T) {
|
||||||
listener := &HTTPListener{
|
listener := &HTTPListener{
|
||||||
ServiceAddress: ":0",
|
ServiceAddress: "localhost:0",
|
||||||
MaxLineSize: 100,
|
MaxLineSize: 100,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ func newTestTcpListener() (*Statsd, chan *bytes.Buffer) {
|
||||||
in := make(chan *bytes.Buffer, 1500)
|
in := make(chan *bytes.Buffer, 1500)
|
||||||
listener := &Statsd{
|
listener := &Statsd{
|
||||||
Protocol: "tcp",
|
Protocol: "tcp",
|
||||||
ServiceAddress: ":8125",
|
ServiceAddress: "localhost:8125",
|
||||||
AllowedPendingMessages: 10000,
|
AllowedPendingMessages: 10000,
|
||||||
MaxTCPConnections: 250,
|
MaxTCPConnections: 250,
|
||||||
in: in,
|
in: in,
|
||||||
|
@ -50,7 +50,7 @@ func NewTestStatsd() *Statsd {
|
||||||
func TestConcurrentConns(t *testing.T) {
|
func TestConcurrentConns(t *testing.T) {
|
||||||
listener := Statsd{
|
listener := Statsd{
|
||||||
Protocol: "tcp",
|
Protocol: "tcp",
|
||||||
ServiceAddress: ":8125",
|
ServiceAddress: "localhost:8125",
|
||||||
AllowedPendingMessages: 10000,
|
AllowedPendingMessages: 10000,
|
||||||
MaxTCPConnections: 2,
|
MaxTCPConnections: 2,
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ func TestConcurrentConns(t *testing.T) {
|
||||||
func TestConcurrentConns1(t *testing.T) {
|
func TestConcurrentConns1(t *testing.T) {
|
||||||
listener := Statsd{
|
listener := Statsd{
|
||||||
Protocol: "tcp",
|
Protocol: "tcp",
|
||||||
ServiceAddress: ":8125",
|
ServiceAddress: "localhost:8125",
|
||||||
AllowedPendingMessages: 10000,
|
AllowedPendingMessages: 10000,
|
||||||
MaxTCPConnections: 1,
|
MaxTCPConnections: 1,
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ func TestConcurrentConns1(t *testing.T) {
|
||||||
func TestCloseConcurrentConns(t *testing.T) {
|
func TestCloseConcurrentConns(t *testing.T) {
|
||||||
listener := Statsd{
|
listener := Statsd{
|
||||||
Protocol: "tcp",
|
Protocol: "tcp",
|
||||||
ServiceAddress: ":8125",
|
ServiceAddress: "localhost:8125",
|
||||||
AllowedPendingMessages: 10000,
|
AllowedPendingMessages: 10000,
|
||||||
MaxTCPConnections: 2,
|
MaxTCPConnections: 2,
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ func TestCloseConcurrentConns(t *testing.T) {
|
||||||
func BenchmarkUDP(b *testing.B) {
|
func BenchmarkUDP(b *testing.B) {
|
||||||
listener := Statsd{
|
listener := Statsd{
|
||||||
Protocol: "udp",
|
Protocol: "udp",
|
||||||
ServiceAddress: ":8125",
|
ServiceAddress: "localhost:8125",
|
||||||
AllowedPendingMessages: 250000,
|
AllowedPendingMessages: 250000,
|
||||||
}
|
}
|
||||||
acc := &testutil.Accumulator{Discard: true}
|
acc := &testutil.Accumulator{Discard: true}
|
||||||
|
@ -159,7 +159,7 @@ func BenchmarkUDP(b *testing.B) {
|
||||||
func BenchmarkTCP(b *testing.B) {
|
func BenchmarkTCP(b *testing.B) {
|
||||||
listener := Statsd{
|
listener := Statsd{
|
||||||
Protocol: "tcp",
|
Protocol: "tcp",
|
||||||
ServiceAddress: ":8125",
|
ServiceAddress: "localhost:8125",
|
||||||
AllowedPendingMessages: 250000,
|
AllowedPendingMessages: 250000,
|
||||||
MaxTCPConnections: 250,
|
MaxTCPConnections: 250,
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ cpu_load_short,host=server06 value=12.0 1422568543702900257
|
||||||
func newTestTcpListener() (*TcpListener, chan []byte) {
|
func newTestTcpListener() (*TcpListener, chan []byte) {
|
||||||
in := make(chan []byte, 1500)
|
in := make(chan []byte, 1500)
|
||||||
listener := &TcpListener{
|
listener := &TcpListener{
|
||||||
ServiceAddress: ":8194",
|
ServiceAddress: "localhost:8194",
|
||||||
AllowedPendingMessages: 10000,
|
AllowedPendingMessages: 10000,
|
||||||
MaxTCPConnections: 250,
|
MaxTCPConnections: 250,
|
||||||
in: in,
|
in: in,
|
||||||
|
@ -45,7 +45,7 @@ func newTestTcpListener() (*TcpListener, chan []byte) {
|
||||||
// benchmark how long it takes to accept & process 100,000 metrics:
|
// benchmark how long it takes to accept & process 100,000 metrics:
|
||||||
func BenchmarkTCP(b *testing.B) {
|
func BenchmarkTCP(b *testing.B) {
|
||||||
listener := TcpListener{
|
listener := TcpListener{
|
||||||
ServiceAddress: ":8198",
|
ServiceAddress: "localhost:8198",
|
||||||
AllowedPendingMessages: 100000,
|
AllowedPendingMessages: 100000,
|
||||||
MaxTCPConnections: 250,
|
MaxTCPConnections: 250,
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ func BenchmarkTCP(b *testing.B) {
|
||||||
|
|
||||||
func TestHighTrafficTCP(t *testing.T) {
|
func TestHighTrafficTCP(t *testing.T) {
|
||||||
listener := TcpListener{
|
listener := TcpListener{
|
||||||
ServiceAddress: ":8199",
|
ServiceAddress: "localhost:8199",
|
||||||
AllowedPendingMessages: 100000,
|
AllowedPendingMessages: 100000,
|
||||||
MaxTCPConnections: 250,
|
MaxTCPConnections: 250,
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ func TestHighTrafficTCP(t *testing.T) {
|
||||||
|
|
||||||
func TestConnectTCP(t *testing.T) {
|
func TestConnectTCP(t *testing.T) {
|
||||||
listener := TcpListener{
|
listener := TcpListener{
|
||||||
ServiceAddress: ":8194",
|
ServiceAddress: "localhost:8194",
|
||||||
AllowedPendingMessages: 10000,
|
AllowedPendingMessages: 10000,
|
||||||
MaxTCPConnections: 250,
|
MaxTCPConnections: 250,
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ func TestConnectTCP(t *testing.T) {
|
||||||
// Test that MaxTCPConections is respected
|
// Test that MaxTCPConections is respected
|
||||||
func TestConcurrentConns(t *testing.T) {
|
func TestConcurrentConns(t *testing.T) {
|
||||||
listener := TcpListener{
|
listener := TcpListener{
|
||||||
ServiceAddress: ":8195",
|
ServiceAddress: "localhost:8195",
|
||||||
AllowedPendingMessages: 10000,
|
AllowedPendingMessages: 10000,
|
||||||
MaxTCPConnections: 2,
|
MaxTCPConnections: 2,
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ func TestConcurrentConns(t *testing.T) {
|
||||||
// Test that MaxTCPConections is respected when max==1
|
// Test that MaxTCPConections is respected when max==1
|
||||||
func TestConcurrentConns1(t *testing.T) {
|
func TestConcurrentConns1(t *testing.T) {
|
||||||
listener := TcpListener{
|
listener := TcpListener{
|
||||||
ServiceAddress: ":8196",
|
ServiceAddress: "localhost:8196",
|
||||||
AllowedPendingMessages: 10000,
|
AllowedPendingMessages: 10000,
|
||||||
MaxTCPConnections: 1,
|
MaxTCPConnections: 1,
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ func TestConcurrentConns1(t *testing.T) {
|
||||||
// Test that MaxTCPConections is respected
|
// Test that MaxTCPConections is respected
|
||||||
func TestCloseConcurrentConns(t *testing.T) {
|
func TestCloseConcurrentConns(t *testing.T) {
|
||||||
listener := TcpListener{
|
listener := TcpListener{
|
||||||
ServiceAddress: ":8195",
|
ServiceAddress: "localhost:8195",
|
||||||
AllowedPendingMessages: 10000,
|
AllowedPendingMessages: 10000,
|
||||||
MaxTCPConnections: 2,
|
MaxTCPConnections: 2,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue