Skip to content

Commit 401976a

Browse files
committed
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.
1 parent a3b2d83 commit 401976a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/test/java/org/logstash/plugins/inputs/http/util/ExecutionObserverTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ void testThreadSafetyBruteForce() {
194194
// without queries, we may have some compaction so we shouldn't be too strict
195195
final ExecutionObserver.Stats preCompactionStats = observer.stats();
196196
assertThat(preCompactionStats.executing, is(0));
197-
assertThat(preCompactionStats.nodes, is(both(greaterThan(0)).and(lessThan((int) Math.sqrt(concurrency)))));
197+
assertThat(preCompactionStats.nodes, is(both(greaterThan(0)).and(lessThan(concurrency))));
198198

199199
// query triggers tail compaction, leaving 2 or fewer nodes.
200200
assertThat(observer.anyExecuting(), is(false));

0 commit comments

Comments
 (0)