Skip to content

Commit 23efbf0

Browse files
authored
ESQL: Stop sending version in tests (#108961)
Now that `version` is no longer required anywhere we can stop sending it in all of our tests. Closes #108957
1 parent 05302f2 commit 23efbf0

File tree

31 files changed

+9
-262
lines changed

31 files changed

+9
-262
lines changed

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

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ public class HeapAttackIT extends ESRestTestCase {
6161

6262
static volatile boolean SUITE_ABORTED = false;
6363

64-
private static String ESQL_VERSION = "2024.04.01";
65-
6664
@Override
6765
protected String getTestRestCluster() {
6866
return cluster.getHttpAddresses();
@@ -156,7 +154,7 @@ private Response groupOnManyLongs(int count) throws IOException {
156154
}
157155

158156
private StringBuilder makeManyLongs(int count) {
159-
StringBuilder query = startQueryWithVersion(ESQL_VERSION);
157+
StringBuilder query = startQuery();
160158
query.append("FROM manylongs\\n| EVAL i0 = a + b, i1 = b + i0");
161159
for (int i = 2; i < count; i++) {
162160
query.append(", i").append(i).append(" = i").append(i - 2).append(" + ").append(i - 1);
@@ -187,7 +185,7 @@ public void testHugeConcat() throws IOException {
187185
}
188186

189187
private Response concat(int evals) throws IOException {
190-
StringBuilder query = startQueryWithVersion(ESQL_VERSION);
188+
StringBuilder query = startQuery();
191189
query.append("FROM single | EVAL str = TO_STRING(a)");
192190
for (int e = 0; e < evals; e++) {
193191
query.append("\n| EVAL str=CONCAT(")
@@ -224,7 +222,7 @@ public void testHugeManyConcat() throws IOException {
224222
* Tests that generate many moderately long strings.
225223
*/
226224
private Response manyConcat(int strings) throws IOException {
227-
StringBuilder query = startQueryWithVersion(ESQL_VERSION);
225+
StringBuilder query = startQuery();
228226
query.append("FROM manylongs | EVAL str = CONCAT(");
229227
query.append(
230228
Arrays.stream(new String[] { "a", "b", "c", "d", "e" })
@@ -276,7 +274,7 @@ public void testTooManyEval() throws IOException {
276274
}
277275

278276
private Response manyEval(int evalLines) throws IOException {
279-
StringBuilder query = startQueryWithVersion(ESQL_VERSION);
277+
StringBuilder query = startQuery();
280278
query.append("FROM manylongs");
281279
for (int e = 0; e < evalLines; e++) {
282280
query.append("\n| EVAL ");
@@ -358,7 +356,7 @@ public void testFetchTooManyBigFields() throws IOException {
358356
* Fetches documents containing 1000 fields which are {@code 1kb} each.
359357
*/
360358
private void fetchManyBigFields(int docs) throws IOException {
361-
StringBuilder query = startQueryWithVersion(ESQL_VERSION);
359+
StringBuilder query = startQuery();
362360
query.append("FROM manybigfields | SORT f000 | LIMIT " + docs + "\"}");
363361
Response response = query(query.toString(), "columns");
364362
Map<?, ?> map = responseAsMap(response);
@@ -387,7 +385,7 @@ public void testAggTooManyMvLongs() throws IOException {
387385
}
388386

389387
private Response aggMvLongs(int fields) throws IOException {
390-
StringBuilder query = startQueryWithVersion(ESQL_VERSION);
388+
StringBuilder query = startQuery();
391389
query.append("FROM mv_longs | STATS MAX(f00) BY f00");
392390
for (int f = 1; f < fields; f++) {
393391
query.append(", f").append(String.format(Locale.ROOT, "%02d", f));
@@ -413,7 +411,7 @@ public void testFetchTooManyMvLongs() throws IOException {
413411
}
414412

415413
private Response fetchMvLongs() throws IOException {
416-
StringBuilder query = startQueryWithVersion(ESQL_VERSION);
414+
StringBuilder query = startQuery();
417415
query.append("FROM mv_longs\"}");
418416
return query(query.toString(), "columns");
419417
}
@@ -584,11 +582,9 @@ public void assertRequestBreakerEmpty() throws Exception {
584582
});
585583
}
586584

587-
private static StringBuilder startQueryWithVersion(String version) {
585+
private static StringBuilder startQuery() {
588586
StringBuilder query = new StringBuilder();
589-
query.append("{\"version\":\"" + version + "\",");
590-
query.append("\"query\":\"");
591-
587+
query.append("{\"query\":\"");
592588
return query;
593589
}
594590
}

x-pack/plugin/esql/qa/security/src/javaRestTest/java/org/elasticsearch/xpack/esql/EsqlAsyncSecurityIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ private Response runAsync(String user, String command) throws IOException {
9090
}
9191
XContentBuilder json = JsonXContent.contentBuilder();
9292
json.startObject();
93-
json.field("version", ESQL_VERSION);
9493
json.field("query", command);
9594
addRandomPragmas(json);
9695
json.field("wait_for_completion_timeout", timeValueNanos(randomIntBetween(1, 1000)));

x-pack/plugin/esql/qa/security/src/javaRestTest/java/org/elasticsearch/xpack/esql/EsqlSecurityIT.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
import static org.hamcrest.Matchers.equalTo;
3939

4040
public class EsqlSecurityIT extends ESRestTestCase {
41-
static String ESQL_VERSION = "2024.04.01.🚀";
42-
4341
@ClassRule
4442
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
4543
.distribution(DistributionType.DEFAULT)
@@ -355,7 +353,6 @@ protected Response runESQLCommand(String user, String command) throws IOExceptio
355353
}
356354
XContentBuilder json = JsonXContent.contentBuilder();
357355
json.startObject();
358-
json.field("version", ESQL_VERSION);
359356
json.field("query", command);
360357
addRandomPragmas(json);
361358
json.endObject();

x-pack/plugin/esql/qa/server/mixed-cluster/build.gradle

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,16 @@ def supportedVersion = bwcVersion -> {
3030
return bwcVersion.onOrAfter(Version.fromString("8.11.0"));
3131
}
3232

33-
// Versions on and after 8.14.0 will get a `version` parameter
34-
def versionRequired = bwcVersion -> {
35-
return bwcVersion == Version.fromString("8.14.0");
36-
}
37-
3833
BuildParams.bwcVersions.withWireCompatible(supportedVersion) { bwcVersion, baseName ->
3934
def javaRestTest = tasks.register("v${bwcVersion}#javaRestTest", StandaloneRestIntegTestTask) {
4035
usesBwcDistribution(bwcVersion)
4136
systemProperty("tests.old_cluster_version", bwcVersion)
42-
systemProperty("tests.version_parameter_required", versionRequired(bwcVersion))
4337
maxParallelForks = 1
4438
}
4539

4640
def yamlRestTest = tasks.register("v${bwcVersion}#yamlRestTest", StandaloneRestIntegTestTask) {
4741
usesBwcDistribution(bwcVersion)
4842
systemProperty("tests.old_cluster_version", bwcVersion)
49-
systemProperty("tests.version_parameter_required", versionRequired(bwcVersion))
5043
testClassesDirs = sourceSets.yamlRestTest.output.classesDirs
5144
classpath = sourceSets.yamlRestTest.runtimeClasspath
5245
}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,6 @@ public RequestObjectBuilder pragmas(Settings pragmas) throws IOException {
173173

174174
public RequestObjectBuilder build() throws IOException {
175175
if (isBuilt == false) {
176-
if ("true".equals(System.getProperty("tests.version_parameter_required"))) {
177-
builder.field("version", "2024.04.01");
178-
}
179176
builder.endObject();
180177
isBuilt = true;
181178
}

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/action/EsqlQueryRequestTests.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ public void testMissingQueryIsNotValid() throws IOException {
204204
public void testPragmasOnlyValidOnSnapshot() throws IOException {
205205
String json = """
206206
{
207-
"version": "2024.04.01",
208207
"query": "ROW x = 1",
209208
"pragma": {"foo": "bar"}
210209
}
@@ -222,7 +221,6 @@ public void testPragmasOnlyValidOnSnapshot() throws IOException {
222221
public void testTablesKeyword() throws IOException {
223222
String json = """
224223
{
225-
"version": "2024.04.01",
226224
"query": "ROW x = 1",
227225
"tables": {"a": {"c:keyword": ["a", "b", null, 1, 2.0, ["c", "d"], false]}}
228226
}
@@ -254,7 +252,6 @@ public void testTablesKeyword() throws IOException {
254252
public void testTablesInteger() throws IOException {
255253
String json = """
256254
{
257-
"version": "2024.04.01",
258255
"query": "ROW x = 1",
259256
"tables": {"a": {"c:integer": [1, 2, "3", null, [5, 6]]}}
260257
}
@@ -283,7 +280,6 @@ public void testTablesInteger() throws IOException {
283280
public void testTablesLong() throws IOException {
284281
String json = """
285282
{
286-
"version": "2024.04.01",
287283
"query": "ROW x = 1",
288284
"tables": {"a": {"c:long": [1, 2, "3", null, [5, 6]]}}
289285
}
@@ -312,7 +308,6 @@ public void testTablesLong() throws IOException {
312308
public void testManyTables() throws IOException {
313309
String json = """
314310
{
315-
"version": "2024.04.01",
316311
"query": "ROW x = 1",
317312
"tables": {
318313
"t1": {

x-pack/plugin/security/qa/multi-cluster/src/javaRestTest/java/org/elasticsearch/xpack/remotecluster/RemoteClusterSecurityEsqlIT.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
import static org.hamcrest.Matchers.equalTo;
4545

4646
public class RemoteClusterSecurityEsqlIT extends AbstractRemoteClusterSecurityTestCase {
47-
private static final String ESQL_VERSION = "2024.04.01";
48-
4947
private static final AtomicReference<Map<String, Object>> API_KEY_MAP_REF = new AtomicReference<>();
5048
private static final AtomicReference<Map<String, Object>> REST_API_KEY_MAP_REF = new AtomicReference<>();
5149
private static final AtomicBoolean SSL_ENABLED_REF = new AtomicBoolean();
@@ -767,7 +765,6 @@ protected Request esqlRequest(String command) throws IOException {
767765
body.endObject();
768766
}
769767
}
770-
body.field("version", ESQL_VERSION);
771768
body.endObject();
772769
Request request = new Request("POST", "_query");
773770
request.setJsonEntity(org.elasticsearch.common.Strings.toString(body));

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/100_bug_fix.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
esql.query:
2323
body:
2424
query: 'FROM test | sort emp_no | eval ip = to_ip(coalesce(ip1.keyword, "255.255.255.255")) | keep emp_no, ip'
25-
version: 2024.04.01
2625

2726
- match: { columns.0.name: "emp_no" }
2827
- match: { columns.0.type: "long" }
@@ -42,8 +41,6 @@
4241
esql.query:
4342
body:
4443
query: 'FROM test | sort emp_no | eval x1 = concat(ip1, ip2), x2 = coalesce(x1, "255.255.255.255"), x3 = to_ip(x2) | keep emp_no, x*'
45-
version: 2024.04.01
46-
4744
- match: { columns.0.name: "emp_no" }
4845
- match: { columns.0.type: "long" }
4946
- match: { columns.1.name: "x1" }
@@ -111,7 +108,6 @@
111108
esql.query:
112109
body:
113110
query: 'from index* metadata _index | limit 5 | sort _index desc'
114-
version: 2024.04.01
115111
- match: { columns.0.name: http.headers }
116112
- match: { columns.0.type: unsupported }
117113
- match: { columns.1.name: http.headers.location }
@@ -174,7 +170,6 @@
174170
esql.query:
175171
body:
176172
query: 'from npe_single_value* | stats x = avg(field1) | limit 10'
177-
version: 2024.04.01
178173
- match: { columns.0.name: x }
179174
- match: { columns.0.type: double }
180175
- length: { values: 1 }
@@ -184,7 +179,6 @@
184179
esql.query:
185180
body:
186181
query: 'from npe_single_value* | stats x = avg(field2) | limit 10'
187-
version: 2024.04.01
188182
- match: { columns.0.name: x }
189183
- match: { columns.0.type: double }
190184
- length: { values: 1 }
@@ -194,7 +188,6 @@
194188
esql.query:
195189
body:
196190
query: 'from npe_single_value* | stats x = avg(field3) | limit 10'
197-
version: 2024.04.01
198191
- match: { columns.0.name: x }
199192
- match: { columns.0.type: double }
200193
- length: { values: 1 }
@@ -238,7 +231,6 @@
238231
esql.query:
239232
body:
240233
query: 'from idx_with_date_ip_txt | where id == 1 | eval x = date_format(text, date), y = date_extract(text2, date), p = date_parse(text, "2024-03-14") | keep x, y, p | limit 1'
241-
version: 2024.04.01
242234
- match: { columns.0.name: x }
243235
- match: { columns.0.type: keyword }
244236
- match: { columns.1.name: y }
@@ -252,7 +244,6 @@
252244
esql.query:
253245
body:
254246
query: 'from idx_with_date_ip_txt | where id > 1 | eval x = cidr_match(ip, text) | sort id | keep id, x | limit 2'
255-
version: 2024.04.01
256247
- match: { columns.0.name: id }
257248
- match: { columns.0.type: long }
258249
- match: { columns.1.name: x }
@@ -296,7 +287,6 @@
296287
esql.query:
297288
body:
298289
query: 'from idx_with_multivalues | eval b = mv_dedupe(boolean), k = mv_dedupe(keyword), i = mv_dedupe(integer), l = mv_dedupe(long), d = mv_dedupe(double) | keep b, k, i, l, d | limit 1'
299-
version: 2024.04.01
300290
- match: { columns.0.name: b }
301291
- match: { columns.0.type: boolean }
302292
- match: { columns.1.name: k }

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/10_basic.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ setup:
118118
esql.query:
119119
body:
120120
query: 'from test'
121-
version: 2024.04.01
122121

123122
- match: {columns.0.name: "color"}
124123
- match: {columns.0.type: "keyword"}
@@ -140,7 +139,6 @@ setup:
140139
esql.query:
141140
body:
142141
query: 'from test | sort count | limit 1'
143-
version: 2024.04.01
144142

145143
- match: {columns.1.name: "count"}
146144
- match: {columns.1.type: "long"}
@@ -153,7 +151,6 @@ setup:
153151
body:
154152
query: 'from test | keep data | sort data | limit 2'
155153
columnar: true
156-
version: 2024.04.01
157154

158155
- match: {columns.0.name: "data"}
159156
- match: {columns.0.type: "long"}
@@ -165,7 +162,6 @@ setup:
165162
esql.query:
166163
body:
167164
query: 'from test | eval x = count + 7 | sort x | limit 1'
168-
version: 2024.04.01
169165

170166
- match: {columns.0.name: "color"}
171167
- match: {columns.1.name: "count"}
@@ -183,7 +179,6 @@ setup:
183179
esql.query:
184180
body:
185181
query: 'from test | sort time | eval x = data + 1, y = data_d + count, z = x + y | keep data, x, y, z, time | limit 2'
186-
version: 2024.04.01
187182

188183
- match: {columns.0.name: "data"}
189184
- match: {columns.0.type: "long"}
@@ -214,7 +209,6 @@ setup:
214209
body:
215210
query: 'from test | sort time | limit 2 | keep count'
216211
columnar: true
217-
version: 2024.04.01
218212

219213
- length: {columns: 1}
220214
- match: {columns.0.name: "count"}
@@ -228,7 +222,6 @@ setup:
228222
body:
229223
query: 'from test | sort time desc | limit 2 | keep count'
230224
columnar: true
231-
version: 2024.04.01
232225

233226
- length: {columns: 1}
234227
- match: {columns.0.name: "count"}
@@ -242,7 +235,6 @@ setup:
242235
body:
243236
query: 'from test | sort time | limit 2 | keep count | eval x = count + 1'
244237
columnar: true
245-
version: 2024.04.01
246238

247239
- length: {columns: 2}
248240
- match: {columns.0.name: "count"}
@@ -260,7 +252,6 @@ setup:
260252
body:
261253
query: 'from test | sort time | limit 2 | keep count | eval x = count + 1 | keep x'
262254
columnar: true
263-
version: 2024.04.01
264255

265256
- length: {columns: 1}
266257
- match: {columns.0.name: "x"}
@@ -274,7 +265,6 @@ setup:
274265
esql.query:
275266
body:
276267
query: 'from test | limit 10 | sort time | limit 1'
277-
version: 2024.04.01
278268

279269
- length: {columns: 6}
280270
- length: {values: 1}
@@ -288,7 +278,6 @@ setup:
288278
body:
289279
query: 'row a = ? | eval b = ?, c = 1 + ?'
290280
params: ["foo", 15, 10]
291-
version: 2024.04.01
292281

293282
- length: {columns: 3}
294283
- match: {columns.0.name: "a"}
@@ -308,7 +297,6 @@ setup:
308297
body:
309298
query: 'from test | where color == ? and count == ? and time == ? | keep data, count, color'
310299
params: ["green", 44, 1674835275193]
311-
version: 2024.04.01
312300

313301
- length: {columns: 3}
314302
- match: {columns.0.name: "data"}
@@ -327,7 +315,6 @@ setup:
327315
body:
328316
query: 'from test | eval x = ?, y = ?, z = ?, t = ?, u = ?, v = ? | keep x, y, z, t, u, v | limit 3'
329317
params: [{"value": 1, "type": "keyword"}, {"value": 2, "type": "double"}, null, true, 123, {"value": 123, "type": "long"}]
330-
version: 2024.04.01
331318

332319
- length: {columns: 6}
333320
- match: {columns.0.name: "x"}

0 commit comments

Comments
 (0)