From 9b42b47777bc99478d774ba12637d61b328cd6c7 Mon Sep 17 00:00:00 2001 From: Dan Kortschak Date: Thu, 7 Sep 2023 06:29:58 +0930 Subject: [PATCH] x-pack/filebeat/input/httpjson: re-enable previously flakey first_event test With the change from concurrent to sequential processing this test is no longer flakey. This is confirmed by re-applying a delay to the publication of the first event in a set of events. This change causes the concurrent code to fail consistently, but the current sequential code passes. The test change used to test the flake is diff --git a/x-pack/filebeat/input/httpjson/request.go b/x-pack/filebeat/input/httpjson/request.go index 6a1d926ab4..3ed904f16d 100644 --- a/x-pack/filebeat/input/httpjson/request.go +++ b/x-pack/filebeat/input/httpjson/request.go @@ -16,6 +16,7 @@ import ( "reflect" "strconv" "strings" + "time" "github.com/PaesslerAG/jsonpath" @@ -741,6 +742,10 @@ func newPublisher(trCtx *transformContext, pub inputcursor.Publisher, publish bo } func (p *publisher) event(_ context.Context, msg mapstr.M) { + if p.n == 0 { + time.Sleep(10 * time.Millisecond) + } + if p.pub != nil { event, err := makeEvent(msg) if err != nil { --- CHANGELOG-developer.next.asciidoc | 1 + x-pack/filebeat/input/httpjson/input_test.go | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG-developer.next.asciidoc b/CHANGELOG-developer.next.asciidoc index 2e918d757dc..2d5ad19bc85 100644 --- a/CHANGELOG-developer.next.asciidoc +++ b/CHANGELOG-developer.next.asciidoc @@ -86,6 +86,7 @@ The list below covers the major changes between 7.0.0-rc2 and main only. - Fix ingest pipeline for panw module to parse url scheme correctly {pull}35757[35757] - Renamed an httpjson input metric to follow naming conventions. `httpjson_interval_pages_total` was renamed to `httpjson_interval_pages` because the `_total` suffix is reserved for counters. {issue}35933[35933] {pull}36169[36169] - Fixed some race conditions in tests {pull}36185[36185] +- Re-enable HTTPJSON fixed flakey test. {issue}34929[34929] {pull}36525[36525] ==== Added diff --git a/x-pack/filebeat/input/httpjson/input_test.go b/x-pack/filebeat/input/httpjson/input_test.go index e88a0a28d30..e4d94527e72 100644 --- a/x-pack/filebeat/input/httpjson/input_test.go +++ b/x-pack/filebeat/input/httpjson/input_test.go @@ -374,8 +374,6 @@ var testCases = []struct { }, }, { - skipReason: "flakey test - see https://github.com/elastic/beats/issues/34929", - name: "first_event", setupServer: func(t testing.TB, h http.HandlerFunc, config map[string]interface{}) { server := httptest.NewServer(h)