mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-22 07:20:59 +00:00
Add noplogger to tests
Signed-off-by: mhartenbower <matt.hartenbower@gmail.com>
This commit is contained in:
parent
c710b851c7
commit
5f4f780e16
3 changed files with 8 additions and 3 deletions
|
@ -16,6 +16,8 @@ package main
|
|||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/go-kit/kit/log"
|
||||
)
|
||||
|
||||
func TestHandlePacket(t *testing.T) {
|
||||
|
@ -413,7 +415,7 @@ func TestHandlePacket(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
for k, l := range []statsDPacketHandler{&StatsDUDPListener{}, &mockStatsDTCPListener{}} {
|
||||
for k, l := range []statsDPacketHandler{&StatsDUDPListener{nil, nil, log.NewNopLogger()}, &mockStatsDTCPListener{StatsDTCPListener{nil, nil, log.NewNopLogger()}, log.NewNopLogger()}} {
|
||||
events := make(chan Events, 32)
|
||||
l.SetEventHandler(&unbufferedEventHandler{c: events})
|
||||
for i, scenario := range scenarios {
|
||||
|
|
|
@ -18,6 +18,7 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -581,7 +582,8 @@ func (l *StatsDUnixgramListener) Listen() {
|
|||
if strings.HasSuffix(err.Error(), "use of closed network connection") {
|
||||
return
|
||||
}
|
||||
panic(err)
|
||||
level.Error(l.logger).Log(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
l.handlePacket(buf[:n])
|
||||
}
|
||||
|
|
|
@ -493,7 +493,7 @@ func TestInvalidUtf8InDatadogTagValue(t *testing.T) {
|
|||
ueh := &unbufferedEventHandler{c: events}
|
||||
|
||||
go func() {
|
||||
for _, l := range []statsDPacketHandler{&StatsDUDPListener{}, &mockStatsDTCPListener{}} {
|
||||
for _, l := range []statsDPacketHandler{&StatsDUDPListener{nil, nil, log.NewNopLogger()}, &mockStatsDTCPListener{StatsDTCPListener{nil, nil, log.NewNopLogger()}, log.NewNopLogger()}} {
|
||||
l.SetEventHandler(ueh)
|
||||
l.handlePacket([]byte("bar:200|c|#tag:value\nbar:200|c|#tag:\xc3\x28invalid"))
|
||||
}
|
||||
|
@ -648,6 +648,7 @@ type statsDPacketHandler interface {
|
|||
|
||||
type mockStatsDTCPListener struct {
|
||||
StatsDTCPListener
|
||||
log.Logger
|
||||
}
|
||||
|
||||
func (ml *mockStatsDTCPListener) handlePacket(packet []byte) {
|
||||
|
|
Loading…
Reference in a new issue