Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ribice committed Jul 29, 2024
1 parent b5b190d commit 19fb22a
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions logrus/logrusentry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -85,17 +86,19 @@ 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": {
entry: &logrus.Entry{
Level: logrus.InfoLevel,
},
want: &sentry.Event{
Level: "info",
Extra: map[string]any{},
Level: "info",
Extra: map[string]any{},
Logger: "logrus",
},
},
"message": {
Expand All @@ -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": {
Expand All @@ -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": {
Expand All @@ -132,6 +137,7 @@ func Test_entryToEvent(t *testing.T) {
Method: http.MethodGet,
Headers: map[string]string{"Host": "example.com"},
},
Logger: "logrus",
},
},
"error": {
Expand All @@ -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": {
Expand All @@ -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": {
Expand Down Expand Up @@ -192,6 +200,7 @@ func Test_entryToEvent(t *testing.T) {
},
},
},
Logger: "logrus",
},
},
"user": {
Expand All @@ -208,6 +217,7 @@ func Test_entryToEvent(t *testing.T) {
User: sentry.User{
ID: "bob",
},
Logger: "logrus",
},
},
"user pointer": {
Expand All @@ -224,6 +234,7 @@ func Test_entryToEvent(t *testing.T) {
User: sentry.User{
ID: "alice",
},
Logger: "logrus",
},
},
"non-user": {
Expand All @@ -237,6 +248,7 @@ func Test_entryToEvent(t *testing.T) {
Extra: map[string]any{
"user": "just say no to drugs",
},
Logger: "logrus",
},
},
}
Expand Down

0 comments on commit 19fb22a

Please sign in to comment.