|
27 | 27 | import org.elasticsearch.test.rest.ESRestTestCase; |
28 | 28 | import org.elasticsearch.test.rest.TestFeatureService; |
29 | 29 | import org.elasticsearch.xcontent.XContentType; |
30 | | -import org.elasticsearch.xpack.esql.AssertWarnings; |
31 | 30 | import org.elasticsearch.xpack.esql.CsvSpecReader.CsvTestCase; |
32 | 31 | import org.elasticsearch.xpack.esql.CsvTestUtils; |
33 | 32 | import org.elasticsearch.xpack.esql.EsqlTestUtils; |
34 | 33 | import org.elasticsearch.xpack.esql.SpecReader; |
35 | 34 | import org.elasticsearch.xpack.esql.plugin.EsqlFeatures; |
| 35 | +import org.elasticsearch.xpack.esql.qa.rest.RestEsqlTestCase.Mode; |
36 | 36 | import org.elasticsearch.xpack.esql.qa.rest.RestEsqlTestCase.RequestObjectBuilder; |
37 | 37 | import org.elasticsearch.xpack.esql.telemetry.TookMetrics; |
38 | 38 | import org.junit.After; |
@@ -97,11 +97,6 @@ public abstract class EsqlSpecTestCase extends ESRestTestCase { |
97 | 97 | protected final Mode mode; |
98 | 98 | protected static Boolean supportsTook; |
99 | 99 |
|
100 | | - public enum Mode { |
101 | | - SYNC, |
102 | | - ASYNC |
103 | | - } |
104 | | - |
105 | 100 | @ParametersFactory(argumentFormatting = "%2$s.%3$s %7$s") |
106 | 101 | public static List<Object[]> readScriptSpec() throws Exception { |
107 | 102 | List<URL> urls = classpathResources("/*.csv-spec"); |
@@ -277,7 +272,12 @@ protected final void doTest(String query) throws Throwable { |
277 | 272 | } |
278 | 273 |
|
279 | 274 | Map<?, ?> prevTooks = supportsTook() ? tooks() : null; |
280 | | - Map<String, Object> answer = runEsql(builder.query(query), testCase.assertWarnings(deduplicateExactWarnings())); |
| 275 | + Map<String, Object> answer = RestEsqlTestCase.runEsql( |
| 276 | + builder.query(query), |
| 277 | + testCase.assertWarnings(deduplicateExactWarnings()), |
| 278 | + profileLogger, |
| 279 | + mode |
| 280 | + ); |
281 | 281 |
|
282 | 282 | assertNotPartial(answer); |
283 | 283 |
|
@@ -330,14 +330,6 @@ protected boolean deduplicateExactWarnings() { |
330 | 330 | return false; |
331 | 331 | } |
332 | 332 |
|
333 | | - private Map<String, Object> runEsql(RequestObjectBuilder requestObject, AssertWarnings assertWarnings) throws IOException { |
334 | | - if (mode == Mode.ASYNC) { |
335 | | - return RestEsqlTestCase.runEsqlAsync(requestObject, assertWarnings, profileLogger); |
336 | | - } else { |
337 | | - return RestEsqlTestCase.runEsqlSync(requestObject, assertWarnings, profileLogger); |
338 | | - } |
339 | | - } |
340 | | - |
341 | 333 | protected void assertResults( |
342 | 334 | ExpectedResults expected, |
343 | 335 | List<Map<String, String>> actualColumns, |
|
0 commit comments