From 1a473943796fc76c31657978f9cf8919cb38a3ea Mon Sep 17 00:00:00 2001 From: Michael Fulbright Date: Thu, 25 Jan 2024 16:00:12 -0500 Subject: [PATCH] feat(tests): Defaults to "null" for expected errors If neither EXPECT_TRACED_ERRORS or EXPECT_ERROR_EVENTS defined then default to "null" for both. This will guarantee there is an explicit expectation for an error if it expected for a test or else it will fail. --- src/newrelic/integration/test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/newrelic/integration/test.go b/src/newrelic/integration/test.go index a82948e15..9698cc434 100644 --- a/src/newrelic/integration/test.go +++ b/src/newrelic/integration/test.go @@ -591,6 +591,12 @@ func (t *Test) Compare(harvest *newrelic.Harvest) { // check for any "expected spans like" t.compareSpanEventsLike(harvest) + // if expected error events and traced errors are undefined - default to "null" + if nil == t.errorEvents && nil == t.tracedErrors { + t.errorEvents = []byte("null") + t.tracedErrors = []byte("null") + } + // check remaining payloads t.comparePayload(t.analyticEvents, harvest.TxnEvents, false) t.comparePayload(t.customEvents, harvest.CustomEvents, false)