Skip to content

Commit

Permalink
Fix more issues that came up
Browse files Browse the repository at this point in the history
  • Loading branch information
veqryn committed Dec 8, 2023
1 parent df987ca commit 9ee0f17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 6 additions & 3 deletions handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ 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",
}},
MetaData: map[string]map[string]any{
"log": {
"time": "2023-09-29T13:00:59Z",
"level": "ERROR",
"source": "replaceme",
"source": "github.com/veqryn/slog-bugsnag.TestHandler:97",
"msg": "main message",
"with1": "arg0",
},
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions log_to_bug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 9ee0f17

Please sign in to comment.