From 19fb22ae4ea37255ee19f018bd24f7c7bac634e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emir=20Ribi=C4=87?= Date: Mon, 29 Jul 2024 11:04:40 +0200 Subject: [PATCH] fix tests --- logrus/logrusentry_test.go | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/logrus/logrusentry_test.go b/logrus/logrusentry_test.go index ee208ab52..db303e43c 100644 --- a/logrus/logrusentry_test.go +++ b/logrus/logrusentry_test.go @@ -73,8 +73,9 @@ func Test_entryToEvent(t *testing.T) { "empty entry": { entry: &logrus.Entry{}, want: &sentry.Event{ - Level: "fatal", - Extra: map[string]any{}, + Level: "fatal", + Extra: map[string]any{}, + Logger: "logrus", }, }, "data fields": { @@ -85,8 +86,9 @@ func Test_entryToEvent(t *testing.T) { }, }, want: &sentry.Event{ - Level: "fatal", - Extra: map[string]any{"bar": "oink", "foo": 123.4}, + Level: "fatal", + Extra: map[string]any{"bar": "oink", "foo": 123.4}, + Logger: "logrus", }, }, "info level": { @@ -94,8 +96,9 @@ func Test_entryToEvent(t *testing.T) { Level: logrus.InfoLevel, }, want: &sentry.Event{ - Level: "info", - Extra: map[string]any{}, + Level: "info", + Extra: map[string]any{}, + Logger: "logrus", }, }, "message": { @@ -106,6 +109,7 @@ func Test_entryToEvent(t *testing.T) { Level: "fatal", Extra: map[string]any{}, Message: "the only thing we have to fear is fear itself", + Logger: "logrus", }, }, "timestamp": { @@ -116,6 +120,7 @@ func Test_entryToEvent(t *testing.T) { Level: "fatal", Extra: map[string]any{}, Timestamp: time.Unix(1, 2).UTC(), + Logger: "logrus", }, }, "http request": { @@ -132,6 +137,7 @@ func Test_entryToEvent(t *testing.T) { Method: http.MethodGet, Headers: map[string]string{"Host": "example.com"}, }, + Logger: "logrus", }, }, "error": { @@ -146,6 +152,7 @@ func Test_entryToEvent(t *testing.T) { Exception: []sentry.Exception{ {Type: "*errors.errorString", Value: "things failed", Stacktrace: &sentry.Stacktrace{Frames: []sentry.Frame{}}}, }, + Logger: "logrus", }, }, "non-error": { @@ -159,6 +166,7 @@ func Test_entryToEvent(t *testing.T) { Extra: map[string]any{ "error": "this isn't really an error", }, + Logger: "logrus", }, }, "error with stack trace": { @@ -192,6 +200,7 @@ func Test_entryToEvent(t *testing.T) { }, }, }, + Logger: "logrus", }, }, "user": { @@ -208,6 +217,7 @@ func Test_entryToEvent(t *testing.T) { User: sentry.User{ ID: "bob", }, + Logger: "logrus", }, }, "user pointer": { @@ -224,6 +234,7 @@ func Test_entryToEvent(t *testing.T) { User: sentry.User{ ID: "alice", }, + Logger: "logrus", }, }, "non-user": { @@ -237,6 +248,7 @@ func Test_entryToEvent(t *testing.T) { Extra: map[string]any{ "user": "just say no to drugs", }, + Logger: "logrus", }, }, }