Skip to content

Commit 22dcdb4

Browse files
committed
Fix tests
1 parent 96583d7 commit 22dcdb4

File tree

4 files changed

+25
-14
lines changed

4 files changed

+25
-14
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-function.csv-spec

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,12 @@ testMatchIpField
202202
required_capability: match_function
203203
required_capability: match_additional_types
204204

205-
from clientips
206-
| where match(client_ip, "172.21.3.15");
205+
from sample_data
206+
| where match(client_ip,"172.21.0.5")
207+
| keep client_ip, message;
207208

208-
client_ip:keyword | env:keyword
209-
172.21.3.15 | Production
209+
client_ip:ip | message:keyword
210+
172.21.0.5 | Disconnected
210211
;
211212

212213
testMatchDateField

x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-operator.csv-spec

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,12 @@ testMatchIpField
222222
required_capability: match_operator_colon
223223
required_capability: match_additional_types
224224

225-
from clientips
226-
| where client_ip:"172.21.3.15";
225+
from sample_data
226+
| where client_ip:"172.21.0.5"
227+
| keep client_ip, message;
227228

228-
client_ip:keyword | env:keyword
229-
172.21.3.15 | Production
229+
client_ip:ip | message:keyword
230+
172.21.0.5 | Disconnected
230231
;
231232

232233
testMatchDateField

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/plugin/MatchOperatorIT.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import org.elasticsearch.action.index.IndexRequest;
1212
import org.elasticsearch.action.support.WriteRequest;
1313
import org.elasticsearch.common.settings.Settings;
14-
import org.elasticsearch.test.junit.annotations.TestLogging;
1514
import org.elasticsearch.xpack.esql.VerificationException;
1615
import org.elasticsearch.xpack.esql.action.AbstractEsqlIntegTestCase;
1716
import org.junit.Before;
@@ -21,7 +20,7 @@
2120
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
2221
import static org.hamcrest.CoreMatchers.containsString;
2322

24-
@TestLogging(value = "org.elasticsearch.xpack.esql:TRACE,org.elasticsearch.compute:TRACE", reason = "debug")
23+
//@TestLogging(value = "org.elasticsearch.xpack.esql:TRACE,org.elasticsearch.compute:TRACE", reason = "debug")
2524
public class MatchOperatorIT extends AbstractEsqlIntegTestCase {
2625

2726
@Before
@@ -197,11 +196,15 @@ public void testMatchWithinEval() {
197196
public void testMatchWithNonTextField() {
198197
var query = """
199198
FROM test
200-
| WHERE id:"fox"
199+
| WHERE id:3
200+
| KEEP id
201201
""";
202202

203-
var error = expectThrows(VerificationException.class, () -> run(query));
204-
assertThat(error.getMessage(), containsString("first argument of [id:\"fox\"] must be [string], found value [id] type [integer]"));
203+
try (var resp = run(query)) {
204+
assertColumnNames(resp.columns(), List.of("id"));
205+
assertColumnTypes(resp.columns(), List.of("integer"));
206+
assertValues(resp.values(), List.of(List.of(3)));
207+
}
205208
}
206209

207210
private void createAndPopulateIndex() {

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/180_match_operator.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ setup:
66
path: /_query
77
parameters: [ method, path, parameters, capabilities ]
88
capabilities: [ match_operator_colon ]
9-
cluster_features: [ "gte_v8.16.0" ]
109
reason: "Match operator added in 8.16.0"
1110
test_runner_features: [capabilities, allowed_warnings_regex]
1211
- do:
@@ -97,6 +96,13 @@ setup:
9796

9897
---
9998
"match with integer field":
99+
- requires:
100+
capabilities:
101+
- method: POST
102+
path: /_query
103+
parameters: [ method, path, parameters, capabilities ]
104+
capabilities: [ match_additional_types ]
105+
reason: "Additional types support for match"
100106
- do:
101107
allowed_warnings_regex:
102108
- "No limit defined, adding default limit of \\[.*\\]"

0 commit comments

Comments
 (0)