Skip to content

Commit

Permalink
Fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
axw committed Jan 24, 2025
1 parent c0814f6 commit 0447a09
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions systemtest/monitoring_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ func TestMonitoring(t *testing.T) {
metrics.Output = nil
getBeatsMonitoringStats(t, srv, &metrics)
acked := gjson.GetBytes(metrics.Libbeat, "output.events.acked")
return acked.Int() == N
// There may be additional pre-aggregated metrics indexed,
// hence we check >= rather than ==.
return acked.Int() >= N
}, 10*time.Second, 10*time.Millisecond)

// Assert the presence of output.write.bytes, and that it is non-zero;
Expand All @@ -93,8 +95,8 @@ func TestMonitoring(t *testing.T) {
assert.Equal(t, int64(0), gjson.GetBytes(metrics.Libbeat, "output.events.active").Int())
assert.Equal(t, int64(0), gjson.GetBytes(metrics.Libbeat, "output.events.failed").Int())
assert.Equal(t, int64(0), gjson.GetBytes(metrics.Libbeat, "output.events.toomany").Int())
assert.Equal(t, int64(N), gjson.GetBytes(metrics.Libbeat, "output.events.total").Int())
assert.Equal(t, int64(N), gjson.GetBytes(metrics.Libbeat, "pipeline.events.total").Int())
assert.GreaterOrEqual(t, int64(N), gjson.GetBytes(metrics.Libbeat, "output.events.total").Int())
assert.GreaterOrEqual(t, int64(N), gjson.GetBytes(metrics.Libbeat, "pipeline.events.total").Int())
assert.Equal(t, "elasticsearch", gjson.GetBytes(metrics.Libbeat, "output.type").Str)

bulkRequestsAvailable := gjson.GetBytes(metrics.Output, "elasticsearch.bulk_requests.available")
Expand Down

0 comments on commit 0447a09

Please sign in to comment.