[TEST] Remove @AwaitsFix from testMemoryBreaker()
Simplifies the test to make it not fail
This commit is contained in:
parent
52fb3c3a09
commit
69d0952c68
|
@ -23,7 +23,9 @@ import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
|
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
|
||||||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
|
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
|
||||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||||
|
import org.elasticsearch.action.search.SearchRequest;
|
||||||
import org.elasticsearch.action.search.SearchRequestBuilder;
|
import org.elasticsearch.action.search.SearchRequestBuilder;
|
||||||
|
import org.elasticsearch.action.search.SearchResponse;
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
import org.elasticsearch.common.breaker.CircuitBreaker;
|
import org.elasticsearch.common.breaker.CircuitBreaker;
|
||||||
import org.elasticsearch.common.breaker.CircuitBreakingException;
|
import org.elasticsearch.common.breaker.CircuitBreakingException;
|
||||||
|
@ -88,10 +90,6 @@ public class CircuitBreakerServiceTests extends ElasticsearchIntegrationTest {
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String randomRidiculouslySmallLimit() {
|
|
||||||
return randomFrom(Arrays.asList("100b", "100"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns true if any of the nodes used a noop breaker */
|
/** Returns true if any of the nodes used a noop breaker */
|
||||||
private boolean noopBreakerUsed() {
|
private boolean noopBreakerUsed() {
|
||||||
NodesStatsResponse stats = client().admin().cluster().prepareNodesStats().setBreaker(true).get();
|
NodesStatsResponse stats = client().admin().cluster().prepareNodesStats().setBreaker(true).get();
|
||||||
|
@ -107,7 +105,6 @@ public class CircuitBreakerServiceTests extends ElasticsearchIntegrationTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elasticsearch/elasticsearch/issues/8710")
|
|
||||||
public void testMemoryBreaker() throws Exception {
|
public void testMemoryBreaker() throws Exception {
|
||||||
if (noopBreakerUsed()) {
|
if (noopBreakerUsed()) {
|
||||||
logger.info("--> noop breakers used, skipping test");
|
logger.info("--> noop breakers used, skipping test");
|
||||||
|
@ -124,22 +121,19 @@ public class CircuitBreakerServiceTests extends ElasticsearchIntegrationTest {
|
||||||
}
|
}
|
||||||
indexRandom(true, false, true, reqs);
|
indexRandom(true, false, true, reqs);
|
||||||
|
|
||||||
// execute a search that loads field data (sorting on the "test" field)
|
|
||||||
SearchRequestBuilder searchRequest = client.prepareSearch("cb-test").setQuery(matchAllQuery()).addSort("test", SortOrder.DESC);
|
|
||||||
searchRequest.get();
|
|
||||||
|
|
||||||
// clear field data cache (thus setting the loaded field data back to 0)
|
// clear field data cache (thus setting the loaded field data back to 0)
|
||||||
clearFieldData();
|
clearFieldData();
|
||||||
|
|
||||||
// Update circuit breaker settings
|
// Update circuit breaker settings
|
||||||
Settings settings = settingsBuilder()
|
Settings settings = settingsBuilder()
|
||||||
.put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING, randomRidiculouslySmallLimit())
|
.put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING, "100b")
|
||||||
.put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING, 1.05)
|
.put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING, 1.05)
|
||||||
.build();
|
.build();
|
||||||
assertAcked(client.admin().cluster().prepareUpdateSettings().setTransientSettings(settings));
|
assertAcked(client.admin().cluster().prepareUpdateSettings().setTransientSettings(settings));
|
||||||
|
|
||||||
// execute a search that loads field data (sorting on the "test" field)
|
// execute a search that loads field data (sorting on the "test" field)
|
||||||
// again, this time it should trip the breaker
|
// again, this time it should trip the breaker
|
||||||
|
SearchRequestBuilder searchRequest = client.prepareSearch("cb-test").setQuery(matchAllQuery()).addSort("test", SortOrder.DESC);
|
||||||
assertFailures(searchRequest, RestStatus.INTERNAL_SERVER_ERROR,
|
assertFailures(searchRequest, RestStatus.INTERNAL_SERVER_ERROR,
|
||||||
containsString("Data too large, data for [test] would be larger than limit of [100/100b]"));
|
containsString("Data too large, data for [test] would be larger than limit of [100/100b]"));
|
||||||
|
|
||||||
|
@ -183,7 +177,7 @@ public class CircuitBreakerServiceTests extends ElasticsearchIntegrationTest {
|
||||||
|
|
||||||
// Update circuit breaker settings
|
// Update circuit breaker settings
|
||||||
Settings settings = settingsBuilder()
|
Settings settings = settingsBuilder()
|
||||||
.put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING, randomRidiculouslySmallLimit())
|
.put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING, "100b")
|
||||||
.put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING, 1.05)
|
.put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING, 1.05)
|
||||||
.build();
|
.build();
|
||||||
assertAcked(client.admin().cluster().prepareUpdateSettings().setTransientSettings(settings));
|
assertAcked(client.admin().cluster().prepareUpdateSettings().setTransientSettings(settings));
|
||||||
|
|
Loading…
Reference in New Issue