Skip to content

Commit 10e6d87

Browse files
authored
ESQL: Bump memory usage on heap attack test (elastic#120620) (elastic#120712)
This particular test expects circuit breaker to trigger when an operation uses too much memory. But it isn't using too much memory in a few builds. This bumps it to use more memory so it will fail as expected. Closes elastic#120587
1 parent fa1cac3 commit 10e6d87

File tree

1 file changed

+14
-8
lines changed
  • test/external-modules/esql-heap-attack/src/javaRestTest/java/org/elasticsearch/xpack/esql/heap_attack

1 file changed

+14
-8
lines changed

test/external-modules/esql-heap-attack/src/javaRestTest/java/org/elasticsearch/xpack/esql/heap_attack/HeapAttackIT.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -631,40 +631,46 @@ private Response fetchMvLongs() throws IOException {
631631
public void testLookupExplosion() throws IOException {
632632
int sensorDataCount = 7500;
633633
int lookupEntries = 10000;
634-
Map<?, ?> map = responseAsMap(lookupExplosion(sensorDataCount, lookupEntries));
634+
Map<?, ?> map = lookupExplosion(sensorDataCount, lookupEntries);
635635
assertMap(map, matchesMap().extraOk().entry("values", List.of(List.of(sensorDataCount * lookupEntries))));
636636
}
637637

638638
public void testLookupExplosionManyMatches() throws IOException {
639-
assertCircuitBreaks(() -> lookupExplosion(8500, 10000));
639+
assertCircuitBreaks(() -> {
640+
Map<?, ?> result = lookupExplosion(8500, 10000);
641+
logger.error("should have failed but got {}", result);
642+
});
640643
}
641644

642-
private Response lookupExplosion(int sensorDataCount, int lookupEntries) throws IOException {
645+
private Map<?, ?> lookupExplosion(int sensorDataCount, int lookupEntries) throws IOException {
643646
initSensorData(sensorDataCount, 1);
644647
initSensorLookup(lookupEntries, 1, i -> "73.9857 40.7484");
645648
StringBuilder query = startQuery();
646649
query.append("FROM sensor_data | LOOKUP JOIN sensor_lookup ON id | STATS COUNT(*)\"}");
647-
return query(query.toString(), null);
650+
return responseAsMap(query(query.toString(), null));
648651
}
649652

650653
public void testEnrichExplosion() throws IOException {
651654
int sensorDataCount = 1000;
652655
int lookupEntries = 100;
653-
Map<?, ?> map = responseAsMap(enrichExplosion(sensorDataCount, lookupEntries));
656+
Map<?, ?> map = enrichExplosion(sensorDataCount, lookupEntries);
654657
assertMap(map, matchesMap().extraOk().entry("values", List.of(List.of(sensorDataCount))));
655658
}
656659

657660
public void testEnrichExplosionManyMatches() throws IOException {
658-
assertCircuitBreaks(() -> enrichExplosion(1000, 10000));
661+
assertCircuitBreaks(() -> {
662+
Map<?, ?> result = enrichExplosion(3000, 10000);
663+
logger.error("should have failed but got {}", result);
664+
});
659665
}
660666

661-
private Response enrichExplosion(int sensorDataCount, int lookupEntries) throws IOException {
667+
private Map<?, ?> enrichExplosion(int sensorDataCount, int lookupEntries) throws IOException {
662668
initSensorData(sensorDataCount, 1);
663669
initSensorEnrich(lookupEntries, 1, i -> "73.9857 40.7484");
664670
try {
665671
StringBuilder query = startQuery();
666672
query.append("FROM sensor_data | ENRICH sensor ON id | STATS COUNT(*)\"}");
667-
return query(query.toString(), null);
673+
return responseAsMap(query(query.toString(), null));
668674
} finally {
669675
Request delete = new Request("DELETE", "/_enrich/policy/sensor");
670676
assertMap(responseAsMap(client().performRequest(delete)), matchesMap().entry("acknowledged", true));

0 commit comments

Comments
 (0)