Skip to content

Commit 0eae933

Browse files
committed
Add profile logging to non-csv tests
1 parent 632cd91 commit 0eae933

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/ProfileLogger.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
* public ProfileLogger profileLogger = new ProfileLogger();
2626
*
2727
* public void test() {
28-
* var response = RestEsqlTestCase.runEsqlSync(..., profileLogger);
28+
* var response = RestEsqlTestCase.runEsql(requestObject, assertWarnings, profileLogger, mode);
29+
* // Or any of the other runEsql methods
2930
* }
3031
* }
3132
* </pre>

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/RestEsqlTestCase.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import org.junit.After;
3737
import org.junit.Assert;
3838
import org.junit.Before;
39+
import org.junit.Rule;
3940

4041
import java.io.ByteArrayOutputStream;
4142
import java.io.IOException;
@@ -76,6 +77,9 @@
7677

7778
public abstract class RestEsqlTestCase extends ESRestTestCase {
7879

80+
@Rule(order = Integer.MIN_VALUE)
81+
public ProfileLogger profileLogger = new ProfileLogger();
82+
7983
// Test runner will run multiple suites in parallel, with some of them requiring preserving state between
8084
// tests (like EsqlSpecTestCase), so test data (like index name) needs not collide and cleanup must be done locally.
8185
private static final String TEST_INDEX_NAME = "rest-esql-test";
@@ -455,7 +459,7 @@ public void testOutOfRangeComparisons() throws IOException {
455459
"Line 1:29: java.lang.IllegalArgumentException: single-value function encountered multi-value"
456460
)
457461
);
458-
var result = runEsql(query, assertWarnings, mode);
462+
var result = runEsql(query, assertWarnings, profileLogger, mode);
459463

460464
var values = as(result.get("values"), ArrayList.class);
461465
assertThat(
@@ -525,7 +529,7 @@ public void testInternalRange() throws IOException {
525529

526530
for (String p : predicates) {
527531
var query = requestObjectBuilder().query(format(null, "from {} | where {}", testIndexName(), p));
528-
var result = runEsql(query, new AssertWarnings.NoWarnings(), mode);
532+
var result = runEsql(query, new AssertWarnings.NoWarnings(), profileLogger, mode);
529533
var values = as(result.get("values"), ArrayList.class);
530534
assertThat(
531535
format(null, "Comparison [{}] should return all rows with single values.", p),
@@ -1240,7 +1244,7 @@ private static String expectedTextBody(String format, int count, @Nullable Chara
12401244
}
12411245

12421246
public Map<String, Object> runEsql(RequestObjectBuilder requestObject) throws IOException {
1243-
return runEsql(requestObject, new AssertWarnings.NoWarnings(), mode);
1247+
return runEsql(requestObject, new AssertWarnings.NoWarnings(), profileLogger, mode);
12441248
}
12451249

12461250
public static Map<String, Object> runEsqlSync(RequestObjectBuilder requestObject) throws IOException {

0 commit comments

Comments
 (0)