From 1e21f278743efcded99dc3a03e83f2a60bdf1f89 Mon Sep 17 00:00:00 2001 From: Lee Hinman Date: Fri, 29 Aug 2014 17:17:03 +0200 Subject: [PATCH] [TEST] fix off-by-one error in BigArrays tests Comparisons for the BigArrays breaker use "greater than" instead of "greater than or equal", which was never an issue before because the test size was not right on a page boundary. A test with an exactly divisible page boundary (4mb exactly in this case) caused the sizes to be equal to, but not exceed, the limit, and never break. The limit should be smaller than the test increments the breaker anyway. --- src/test/java/org/elasticsearch/common/util/BigArraysTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/elasticsearch/common/util/BigArraysTests.java b/src/test/java/org/elasticsearch/common/util/BigArraysTests.java index 136990442d1..aca32a75b44 100644 --- a/src/test/java/org/elasticsearch/common/util/BigArraysTests.java +++ b/src/test/java/org/elasticsearch/common/util/BigArraysTests.java @@ -336,7 +336,7 @@ public class BigArraysTests extends ElasticsearchSingleNodeTest { for (String type : Arrays.asList("Byte", "Int", "Long", "Float", "Double", "Object")) { HierarchyCircuitBreakerService hcbs = new HierarchyCircuitBreakerService( ImmutableSettings.builder() - .put(HierarchyCircuitBreakerService.REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING, size) + .put(HierarchyCircuitBreakerService.REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING, size - 1) .build(), new NodeSettingsService(ImmutableSettings.EMPTY)); BigArrays bigArrays = new BigArrays(ImmutableSettings.EMPTY, null, hcbs).withCircuitBreaking();