From 69c1a4cde787eec175fd88f294db724f92489931 Mon Sep 17 00:00:00 2001 From: Edoardo Tenani Date: Fri, 30 Jun 2023 11:11:20 +0200 Subject: [PATCH] test received --- input/otlp/metrics_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/input/otlp/metrics_test.go b/input/otlp/metrics_test.go index b365ada0..7b4cb721 100644 --- a/input/otlp/metrics_test.go +++ b/input/otlp/metrics_test.go @@ -763,6 +763,16 @@ func eventsMatch(t *testing.T, expected []*modelpb.APMEvent, actual []*modelpb.A sort.Slice(actual, func(i, j int) bool { return strings.Compare(actual[i].String(), actual[j].String()) == -1 }) + + now := time.Now().Unix() + for i, e := range actual { + assert.InDelta(t, now, e.Event.Received.AsTime().Unix(), 2) + e.Event.Received = nil + if expected[i].Event == nil { + e.Event = nil + } + } + diff := cmp.Diff( expected, actual, protocmp.Transform(),