Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have all test listeners listen only on localhost #3667

Merged
merged 1 commit into from Jan 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions plugins/inputs/http_listener/http_listener_test.go
Expand Up @@ -114,7 +114,7 @@ var (

func newTestHTTPListener() *HTTPListener {
listener := &HTTPListener{
ServiceAddress: ":0",
ServiceAddress: "localhost:0",
}
return listener
}
Expand Down Expand Up @@ -155,7 +155,7 @@ func newTestHTTPSListener() *HTTPListener {
})

listener := &HTTPListener{
ServiceAddress: ":0",
ServiceAddress: "localhost:0",
TlsAllowedCacerts: allowedCAFiles,
TlsCert: serviceCertFile,
TlsKey: serviceKeyFile,
Expand Down Expand Up @@ -309,7 +309,7 @@ func TestWriteHTTPNoNewline(t *testing.T) {

func TestWriteHTTPMaxLineSizeIncrease(t *testing.T) {
listener := &HTTPListener{
ServiceAddress: ":0",
ServiceAddress: "localhost:0",
MaxLineSize: 128 * 1000,
}

Expand All @@ -326,7 +326,7 @@ func TestWriteHTTPMaxLineSizeIncrease(t *testing.T) {

func TestWriteHTTPVerySmallMaxBody(t *testing.T) {
listener := &HTTPListener{
ServiceAddress: ":0",
ServiceAddress: "localhost:0",
MaxBodySize: 4096,
}

Expand All @@ -342,7 +342,7 @@ func TestWriteHTTPVerySmallMaxBody(t *testing.T) {

func TestWriteHTTPVerySmallMaxLineSize(t *testing.T) {
listener := &HTTPListener{
ServiceAddress: ":0",
ServiceAddress: "localhost:0",
MaxLineSize: 70,
}

Expand All @@ -368,7 +368,7 @@ func TestWriteHTTPVerySmallMaxLineSize(t *testing.T) {

func TestWriteHTTPLargeLinesSkipped(t *testing.T) {
listener := &HTTPListener{
ServiceAddress: ":0",
ServiceAddress: "localhost:0",
MaxLineSize: 100,
}

Expand Down
12 changes: 6 additions & 6 deletions plugins/inputs/statsd/statsd_test.go
Expand Up @@ -21,7 +21,7 @@ func newTestTcpListener() (*Statsd, chan *bytes.Buffer) {
in := make(chan *bytes.Buffer, 1500)
listener := &Statsd{
Protocol: "tcp",
ServiceAddress: ":8125",
ServiceAddress: "localhost:8125",
AllowedPendingMessages: 10000,
MaxTCPConnections: 250,
in: in,
Expand Down Expand Up @@ -50,7 +50,7 @@ func NewTestStatsd() *Statsd {
func TestConcurrentConns(t *testing.T) {
listener := Statsd{
Protocol: "tcp",
ServiceAddress: ":8125",
ServiceAddress: "localhost:8125",
AllowedPendingMessages: 10000,
MaxTCPConnections: 2,
}
Expand Down Expand Up @@ -80,7 +80,7 @@ func TestConcurrentConns(t *testing.T) {
func TestConcurrentConns1(t *testing.T) {
listener := Statsd{
Protocol: "tcp",
ServiceAddress: ":8125",
ServiceAddress: "localhost:8125",
AllowedPendingMessages: 10000,
MaxTCPConnections: 1,
}
Expand Down Expand Up @@ -108,7 +108,7 @@ func TestConcurrentConns1(t *testing.T) {
func TestCloseConcurrentConns(t *testing.T) {
listener := Statsd{
Protocol: "tcp",
ServiceAddress: ":8125",
ServiceAddress: "localhost:8125",
AllowedPendingMessages: 10000,
MaxTCPConnections: 2,
}
Expand All @@ -129,7 +129,7 @@ func TestCloseConcurrentConns(t *testing.T) {
func BenchmarkUDP(b *testing.B) {
listener := Statsd{
Protocol: "udp",
ServiceAddress: ":8125",
ServiceAddress: "localhost:8125",
AllowedPendingMessages: 250000,
}
acc := &testutil.Accumulator{Discard: true}
Expand Down Expand Up @@ -159,7 +159,7 @@ func BenchmarkUDP(b *testing.B) {
func BenchmarkTCP(b *testing.B) {
listener := Statsd{
Protocol: "tcp",
ServiceAddress: ":8125",
ServiceAddress: "localhost:8125",
AllowedPendingMessages: 250000,
MaxTCPConnections: 250,
}
Expand Down
14 changes: 7 additions & 7 deletions plugins/inputs/tcp_listener/tcp_listener_test.go
Expand Up @@ -33,7 +33,7 @@ cpu_load_short,host=server06 value=12.0 1422568543702900257
func newTestTcpListener() (*TcpListener, chan []byte) {
in := make(chan []byte, 1500)
listener := &TcpListener{
ServiceAddress: ":8194",
ServiceAddress: "localhost:8194",
AllowedPendingMessages: 10000,
MaxTCPConnections: 250,
in: in,
Expand All @@ -45,7 +45,7 @@ func newTestTcpListener() (*TcpListener, chan []byte) {
// benchmark how long it takes to accept & process 100,000 metrics:
func BenchmarkTCP(b *testing.B) {
listener := TcpListener{
ServiceAddress: ":8198",
ServiceAddress: "localhost:8198",
AllowedPendingMessages: 100000,
MaxTCPConnections: 250,
}
Expand Down Expand Up @@ -76,7 +76,7 @@ func BenchmarkTCP(b *testing.B) {

func TestHighTrafficTCP(t *testing.T) {
listener := TcpListener{
ServiceAddress: ":8199",
ServiceAddress: "localhost:8199",
AllowedPendingMessages: 100000,
MaxTCPConnections: 250,
}
Expand All @@ -103,7 +103,7 @@ func TestHighTrafficTCP(t *testing.T) {

func TestConnectTCP(t *testing.T) {
listener := TcpListener{
ServiceAddress: ":8194",
ServiceAddress: "localhost:8194",
AllowedPendingMessages: 10000,
MaxTCPConnections: 250,
}
Expand Down Expand Up @@ -140,7 +140,7 @@ func TestConnectTCP(t *testing.T) {
// Test that MaxTCPConections is respected
func TestConcurrentConns(t *testing.T) {
listener := TcpListener{
ServiceAddress: ":8195",
ServiceAddress: "localhost:8195",
AllowedPendingMessages: 10000,
MaxTCPConnections: 2,
}
Expand Down Expand Up @@ -175,7 +175,7 @@ func TestConcurrentConns(t *testing.T) {
// Test that MaxTCPConections is respected when max==1
func TestConcurrentConns1(t *testing.T) {
listener := TcpListener{
ServiceAddress: ":8196",
ServiceAddress: "localhost:8196",
AllowedPendingMessages: 10000,
MaxTCPConnections: 1,
}
Expand Down Expand Up @@ -208,7 +208,7 @@ func TestConcurrentConns1(t *testing.T) {
// Test that MaxTCPConections is respected
func TestCloseConcurrentConns(t *testing.T) {
listener := TcpListener{
ServiceAddress: ":8195",
ServiceAddress: "localhost:8195",
AllowedPendingMessages: 10000,
MaxTCPConnections: 2,
}
Expand Down