diff --git a/CHANGELOG-developer.next.asciidoc b/CHANGELOG-developer.next.asciidoc index 01a7205e713..0e64ed2754c 100644 --- a/CHANGELOG-developer.next.asciidoc +++ b/CHANGELOG-developer.next.asciidoc @@ -106,6 +106,7 @@ The list below covers the major changes between 7.0.0-rc2 and main only. - Close connections properly in Filbeat's HTTPJSON input. {pull}39790[39790] - Add the Offset property to libbeat/reader.Message to store the total number of bytes read and discarded before generating the message. This enables inputs to accurately determine how much data has been read up to the message, using Message.Bytes + Message.Offset. {pull}39873[39873] {issue}39653[39653] - AWS CloudWatch Metrics record previous endTime to use for next collection period and change log.logger from cloudwatch to aws.cloudwatch. {pull}40870[40870] +- Fix flaky test in cel and httpjson inputs of filebeat. {issue}40503[40503] {pull}41358[41358] ==== Added diff --git a/x-pack/filebeat/input/cel/input_test.go b/x-pack/filebeat/input/cel/input_test.go index 1667fe7c282..9e4fe746d76 100644 --- a/x-pack/filebeat/input/cel/input_test.go +++ b/x-pack/filebeat/input/cel/input_test.go @@ -10,7 +10,6 @@ import ( "flag" "fmt" "io" - "math/rand" "net/http" "net/http/httptest" "net/url" @@ -1947,7 +1946,8 @@ func retryHandler() http.HandlerFunc { w.Write([]byte(`{"hello":"world"}`)) return } - w.WriteHeader(rand.Intn(100) + 500) + // Any 5xx except 501 will result in a retry. + w.WriteHeader(500) count++ } } diff --git a/x-pack/filebeat/input/httpjson/input_test.go b/x-pack/filebeat/input/httpjson/input_test.go index 4f09d8f057f..1416efa3c78 100644 --- a/x-pack/filebeat/input/httpjson/input_test.go +++ b/x-pack/filebeat/input/httpjson/input_test.go @@ -8,7 +8,6 @@ import ( "context" "fmt" "io" - "math/rand" "net/http" "net/http/httptest" "os" @@ -1724,7 +1723,8 @@ func retryHandler() http.HandlerFunc { _, _ = w.Write([]byte(`{"hello":"world"}`)) return } - w.WriteHeader(rand.Intn(100) + 500) + // Any 5xx except 501 will result in a retry. + w.WriteHeader(500) count += 1 } }