From 9ee0f178d4eb3db4c2beda2da1fa62fb56aed548 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Fri, 8 Dec 2023 04:31:43 -0700 Subject: [PATCH] Fix more issues that came up --- handler_test.go | 9 ++++++--- log_to_bug_test.go | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/handler_test.go b/handler_test.go index 3bc3323..7130552 100644 --- a/handler_test.go +++ b/handler_test.go @@ -25,6 +25,9 @@ func TestHandler(t *testing.T) { ErrorClass string `json:"errorClass"` Message string `json:"message"` }{{ + ErrorClass: "slogbugsnag.errorWithCallers", + Message: "main message", + }, { ErrorClass: "*errors.errorString", Message: "main message", }}, @@ -32,7 +35,7 @@ func TestHandler(t *testing.T) { "log": { "time": "2023-09-29T13:00:59Z", "level": "ERROR", - "source": "replaceme", + "source": "github.com/veqryn/slog-bugsnag.TestHandler:97", "msg": "main message", "with1": "arg0", }, @@ -63,8 +66,8 @@ func TestHandler(t *testing.T) { } // Replace source field since it changes - expectation.Events[0].MetaData["log"]["source"] = payload.Events[0].MetaData["log"]["source"] - expectation.Events[0].MetaData["log"] = payload.Events[0].MetaData["log"] // TODO: Deleteme + t.Log(payload.Events[0].MetaData["log"]["source"]) + expectation.Events[0].MetaData["log"]["time"] = payload.Events[0].MetaData["log"]["time"] if !reflect.DeepEqual(payload, expectation) { t.Errorf("%#+v\n", payload) diff --git a/log_to_bug_test.go b/log_to_bug_test.go index ef60db1..e498acb 100644 --- a/log_to_bug_test.go +++ b/log_to_bug_test.go @@ -15,9 +15,11 @@ import ( "time" "github.com/bugsnag/bugsnag-go/v2" + "github.com/bugsnag/bugsnag-go/v2/device" ) func init() { + device.GetRuntimeVersions() // TODO: fix issue in vendored bugsnag's library bugsnag.Configure(bugsnag.Configuration{ APIKey: "1234567890abcdef1234567890abcdef", // Should be set by env var, 32 characters @@ -203,6 +205,7 @@ func TestLogToBug(t *testing.T) { } // Replace source field since it changes + t.Log(payload.Events[0].MetaData["log"]["source"]) expectation.Events[0].MetaData["log"]["source"] = payload.Events[0].MetaData["log"]["source"] if !reflect.DeepEqual(payload, expectation) {