X-Git-Url: https://git.r.bdr.sh/rbdr/mobius/blobdiff_plain/7cd900d61edbd6d322db3cecb913adf574389320..95159e5585762c06c654945070ba54262b7dcec9:/hotline/server_blackbox_test.go diff --git a/hotline/server_blackbox_test.go b/hotline/server_blackbox_test.go index 138a17f..059fe5a 100644 --- a/hotline/server_blackbox_test.go +++ b/hotline/server_blackbox_test.go @@ -1,30 +1,15 @@ package hotline import ( - "bytes" "encoding/hex" "github.com/stretchr/testify/assert" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" + "log/slog" "os" "testing" ) -func NewTestLogger() *zap.SugaredLogger { - encoderCfg := zap.NewProductionEncoderConfig() - encoderCfg.TimeKey = "timestamp" - encoderCfg.EncodeTime = zapcore.ISO8601TimeEncoder - - core := zapcore.NewCore( - zapcore.NewConsoleEncoder(encoderCfg), - zapcore.Lock(os.Stdout), - zap.DebugLevel, - ) - - cores := []zapcore.Core{core} - l := zap.New(zapcore.NewTee(cores...)) - defer func() { _ = l.Sync() }() - return l.Sugar() +func NewTestLogger() *slog.Logger { + return slog.New(slog.NewTextHandler(os.Stdout, nil)) } // assertTransferBytesEqual takes a string with a hexdump in the same format that `hexdump -C` produces and compares with @@ -54,7 +39,7 @@ func tranAssertEqual(t *testing.T, tran1, tran2 []Transaction) bool { trans.ID = []byte{0, 0, 0, 0} var fs []Field for _, field := range trans.Fields { - if bytes.Equal(field.ID, []byte{0x00, 0x6b}) { + if field.ID == [2]byte{0x00, 0x6b} { continue } fs = append(fs, field) @@ -67,7 +52,7 @@ func tranAssertEqual(t *testing.T, tran1, tran2 []Transaction) bool { trans.ID = []byte{0, 0, 0, 0} var fs []Field for _, field := range trans.Fields { - if bytes.Equal(field.ID, []byte{0x00, 0x6b}) { + if field.ID == [2]byte{0x00, 0x6b} { continue } fs = append(fs, field)