Skip to content

Commit 2014e76

Browse files
authored
ESQL: Stop sending version in tests (#108961) (#108984)
Now that `version` is no longer required anywhere we can stop sending it in all of our tests. Closes #108957
1 parent 3d2ceb1 commit 2014e76

File tree

28 files changed

+9
-240
lines changed

28 files changed

+9
-240
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" })
@@ -275,7 +273,7 @@ public void testTooManyEval() throws IOException {
275273
}
276274

277275
private Response manyEval(int evalLines) throws IOException {
278-
StringBuilder query = startQueryWithVersion(ESQL_VERSION);
276+
StringBuilder query = startQuery();
279277
query.append("FROM manylongs");
280278
for (int e = 0; e < evalLines; e++) {
281279
query.append("\n| EVAL ");
@@ -357,7 +355,7 @@ public void testFetchTooManyBigFields() throws IOException {
357355
* Fetches documents containing 1000 fields which are {@code 1kb} each.
358356
*/
359357
private void fetchManyBigFields(int docs) throws IOException {
360-
StringBuilder query = startQueryWithVersion(ESQL_VERSION);
358+
StringBuilder query = startQuery();
361359
query.append("FROM manybigfields | SORT f000 | LIMIT " + docs + "\"}");
362360
Response response = query(query.toString(), "columns");
363361
Map<?, ?> map = responseAsMap(response);
@@ -386,7 +384,7 @@ public void testAggTooManyMvLongs() throws IOException {
386384
}
387385

388386
private Response aggMvLongs(int fields) throws IOException {
389-
StringBuilder query = startQueryWithVersion(ESQL_VERSION);
387+
StringBuilder query = startQuery();
390388
query.append("FROM mv_longs | STATS MAX(f00) BY f00");
391389
for (int f = 1; f < fields; f++) {
392390
query.append(", f").append(String.format(Locale.ROOT, "%02d", f));
@@ -412,7 +410,7 @@ public void testFetchTooManyMvLongs() throws IOException {
412410
}
413411

414412
private Response fetchMvLongs() throws IOException {
415-
StringBuilder query = startQueryWithVersion(ESQL_VERSION);
413+
StringBuilder query = startQuery();
416414
query.append("FROM mv_longs\"}");
417415
return query(query.toString(), "columns");
418416
}
@@ -583,11 +581,9 @@ public void assertRequestBreakerEmpty() throws Exception {
583581
});
584582
}
585583

586-
private static StringBuilder startQueryWithVersion(String version) {
584+
private static StringBuilder startQuery() {
587585
StringBuilder query = new StringBuilder();
588-
query.append("{\"version\":\"" + version + "\",");
589-
query.append("\"query\":\"");
590-
586+
query.append("{\"query\":\"");
591587
return query;
592588
}
593589
}

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/src/test/java/org/elasticsearch/xpack/esql/action/EsqlQueryRequestTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ public void testMissingQueryIsNotValid() throws IOException {
193193
public void testPragmasOnlyValidOnSnapshot() throws IOException {
194194
String json = """
195195
{
196-
"version": "2024.04.01",
197196
"query": "ROW x = 1",
198197
"pragma": {"foo": "bar"}
199198
}

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

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

4646
public class RemoteClusterSecurityEsqlIT extends AbstractRemoteClusterSecurityTestCase {
47-
4847
private static final AtomicReference<Map<String, Object>> API_KEY_MAP_REF = new AtomicReference<>();
4948
private static final AtomicReference<Map<String, Object>> REST_API_KEY_MAP_REF = new AtomicReference<>();
5049
private static final AtomicBoolean SSL_ENABLED_REF = new AtomicBoolean();
@@ -690,9 +689,6 @@ protected Request esqlRequest(String command) throws IOException {
690689
body.endObject();
691690
}
692691
}
693-
// TODO: we should use the latest or a random version, even when new versions are released.
694-
String version = Build.current().isSnapshot() ? "snapshot" : "2024.04.01";
695-
body.field("version", version);
696692
body.endObject();
697693
Request request = new Request("POST", "_query");
698694
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"}

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/110_all_null.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ row wise and keep null:
122122
body:
123123
query: 'FROM test | WHERE time <= 1674835275188 | SORT time ASC | LIMIT 2'
124124
columnar: false
125-
version: 2024.04.01
126125

127126
- length: {columns: 8}
128127
- match: {columns.0.name: "always_null"}
@@ -154,7 +153,6 @@ row wise and drop null:
154153
body:
155154
query: 'FROM test | WHERE time <= 1674835275188 | SORT time ASC | LIMIT 2'
156155
columnar: false
157-
version: 2024.04.01
158156

159157
- length: {all_columns: 8}
160158
- match: {all_columns.0.name: "always_null"}
@@ -198,7 +196,6 @@ columnar and keep null:
198196
body:
199197
query: 'FROM test | WHERE time <= 1674835275188 | SORT time ASC | LIMIT 2'
200198
columnar: true
201-
version: 2024.04.01
202199

203200
- length: {columns: 8}
204201
- match: {columns.0.name: "always_null"}
@@ -230,7 +227,6 @@ columnar and drop null:
230227
body:
231228
query: 'FROM test | WHERE time <= 1674835275188 | SORT time ASC | LIMIT 2'
232229
columnar: true
233-
version: 2024.04.01
234230

235231
- length: {all_columns: 8}
236232
- match: {all_columns.0.name: "always_null"}

0 commit comments

Comments
 (0)