Skip to content

Commit 94e4e07

Browse files
committed
test fix
1 parent 7fb5e63 commit 94e4e07

File tree

1 file changed

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

1 file changed

+10
-15
lines changed

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

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void skipOnAborted() {
8686
public void testSortByManyLongsSuccess() throws IOException {
8787
initManyLongs();
8888
Response response = sortByManyLongs(500);
89-
Map<?, ?> map = responseAsMap(response);
89+
Map<String, Object> map = responseAsMap(response);
9090
ListMatcher columns = matchesList().item(matchesMap().entry("name", "a").entry("type", "long"))
9191
.item(matchesMap().entry("name", "b").entry("type", "long"));
9292
ListMatcher values = matchesList();
@@ -95,8 +95,7 @@ public void testSortByManyLongsSuccess() throws IOException {
9595
values = values.item(List.of(0, b));
9696
}
9797
}
98-
MapMatcher mapMatcher = matchesMap();
99-
assertMap(map, mapMatcher.entry("columns", columns).entry("values", values).entry("took", greaterThanOrEqualTo(0)));
98+
assertResultMap(map, columns, values);
10099
}
101100

102101
/**
@@ -236,11 +235,10 @@ private StringBuilder makeSortByManyLongs(int count) {
236235
public void testGroupOnSomeLongs() throws IOException {
237236
initManyLongs();
238237
Response resp = groupOnManyLongs(200);
239-
Map<?, ?> map = responseAsMap(resp);
238+
Map<String, Object> map = responseAsMap(resp);
240239
ListMatcher columns = matchesList().item(matchesMap().entry("name", "MAX(a)").entry("type", "long"));
241240
ListMatcher values = matchesList().item(List.of(9));
242-
MapMatcher mapMatcher = matchesMap();
243-
assertMap(map, mapMatcher.entry("columns", columns).entry("values", values).entry("took", greaterThanOrEqualTo(0)));
241+
assertResultMap(map, columns, values);
244242
}
245243

246244
/**
@@ -249,11 +247,10 @@ public void testGroupOnSomeLongs() throws IOException {
249247
public void testGroupOnManyLongs() throws IOException {
250248
initManyLongs();
251249
Response resp = groupOnManyLongs(5000);
252-
Map<?, ?> map = responseAsMap(resp);
250+
Map<String, Object> map = responseAsMap(resp);
253251
ListMatcher columns = matchesList().item(matchesMap().entry("name", "MAX(a)").entry("type", "long"));
254252
ListMatcher values = matchesList().item(List.of(9));
255-
MapMatcher mapMatcher = matchesMap();
256-
assertMap(map, mapMatcher.entry("columns", columns).entry("values", values).entry("took", greaterThanOrEqualTo(0)));
253+
assertResultMap(map, columns, values);
257254
}
258255

259256
private Response groupOnManyLongs(int count) throws IOException {
@@ -279,12 +276,11 @@ private StringBuilder makeManyLongs(int count) {
279276
public void testSmallConcat() throws IOException {
280277
initSingleDocIndex();
281278
Response resp = concat(2);
282-
Map<?, ?> map = responseAsMap(resp);
279+
Map<String, Object> map = responseAsMap(resp);
283280
ListMatcher columns = matchesList().item(matchesMap().entry("name", "a").entry("type", "long"))
284281
.item(matchesMap().entry("name", "str").entry("type", "keyword"));
285282
ListMatcher values = matchesList().item(List.of(1, "1".repeat(100)));
286-
MapMatcher mapMatcher = matchesMap();
287-
assertMap(map, mapMatcher.entry("columns", columns).entry("values", values).entry("took", greaterThanOrEqualTo(0)));
283+
assertResultMap(map, columns, values);
288284
}
289285

290286
public void testHugeConcat() throws IOException {
@@ -465,7 +461,7 @@ private void assertManyStrings(Response resp, int strings) throws IOException {
465461
public void testManyEval() throws IOException {
466462
initManyLongs();
467463
Response resp = manyEval(1);
468-
Map<?, ?> map = responseAsMap(resp);
464+
Map<String, Object> map = responseAsMap(resp);
469465
ListMatcher columns = matchesList();
470466
columns = columns.item(matchesMap().entry("name", "a").entry("type", "long"));
471467
columns = columns.item(matchesMap().entry("name", "b").entry("type", "long"));
@@ -475,8 +471,7 @@ public void testManyEval() throws IOException {
475471
for (int i = 0; i < 20; i++) {
476472
columns = columns.item(matchesMap().entry("name", "i0" + i).entry("type", "long"));
477473
}
478-
MapMatcher mapMatcher = matchesMap();
479-
assertMap(map, mapMatcher.entry("columns", columns).entry("values", hasSize(10_000)).entry("took", greaterThanOrEqualTo(0)));
474+
assertResultMap(map, columns, hasSize(10_000));
480475
}
481476

482477
public void testTooManyEval() throws IOException {

0 commit comments

Comments
 (0)