From a3b2d839a389e5d585bbcffbe24c72f637dca17c Mon Sep 17 00:00:00 2001 From: Cas Donoghue Date: Wed, 22 Oct 2025 09:42:21 -0700 Subject: [PATCH 1/2] Update src/test/java/org/logstash/plugins/inputs/http/util/ExecutionObserverTest.java Co-authored-by: Rye Biesemeyer --- .../plugins/inputs/http/util/ExecutionObserverTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/logstash/plugins/inputs/http/util/ExecutionObserverTest.java b/src/test/java/org/logstash/plugins/inputs/http/util/ExecutionObserverTest.java index fda18093..4c08a9f5 100644 --- a/src/test/java/org/logstash/plugins/inputs/http/util/ExecutionObserverTest.java +++ b/src/test/java/org/logstash/plugins/inputs/http/util/ExecutionObserverTest.java @@ -191,7 +191,7 @@ void testThreadSafetyBruteForce() { assertThat(maxConcurrency.get(), is(greaterThan(1))); assertThat(maxNodes.get(), is(lessThanOrEqualTo(concurrency * 2))); - // without queries, we should at least have some compaction + // without queries, we may have some compaction so we shouldn't be too strict final ExecutionObserver.Stats preCompactionStats = observer.stats(); assertThat(preCompactionStats.executing, is(0)); assertThat(preCompactionStats.nodes, is(both(greaterThan(0)).and(lessThan((int) Math.sqrt(concurrency))))); From 401976a949e3f3b401610d2d2f92e05872ec7ae3 Mon Sep 17 00:00:00 2001 From: donoghuc Date: Mon, 20 Oct 2025 15:12:08 -0700 Subject: [PATCH 2/2] Fix flaky assertion bound in testThreadSafetyBruteForce Local compaction depends on completion order and timing. Under certain cases node count can reach or exceed `sqrt(concurrency)` before the final compaction is triggered. The test for intermediate state was failing fairly often in CI. This commit updates the test for intermediate state to simply be less than `concurrency`. This should satisfy the intent of the test, with the added security of the rest of the test asserting the finalized state is less than 2 nodes. --- .../plugins/inputs/http/util/ExecutionObserverTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/logstash/plugins/inputs/http/util/ExecutionObserverTest.java b/src/test/java/org/logstash/plugins/inputs/http/util/ExecutionObserverTest.java index 4c08a9f5..7d7d5b88 100644 --- a/src/test/java/org/logstash/plugins/inputs/http/util/ExecutionObserverTest.java +++ b/src/test/java/org/logstash/plugins/inputs/http/util/ExecutionObserverTest.java @@ -194,7 +194,7 @@ void testThreadSafetyBruteForce() { // without queries, we may have some compaction so we shouldn't be too strict final ExecutionObserver.Stats preCompactionStats = observer.stats(); assertThat(preCompactionStats.executing, is(0)); - assertThat(preCompactionStats.nodes, is(both(greaterThan(0)).and(lessThan((int) Math.sqrt(concurrency))))); + assertThat(preCompactionStats.nodes, is(both(greaterThan(0)).and(lessThan(concurrency)))); // query triggers tail compaction, leaving 2 or fewer nodes. assertThat(observer.anyExecuting(), is(false));