Skip to content

Commit 8e02bc3

Browse files
authored
EQL: Expand verification tests (#52664)
Expand verification tests Fix some error messaging consistency in EqlParser Related to #51873
1 parent b49b8db commit 8e02bc3

File tree

18 files changed

+615
-15
lines changed

18 files changed

+615
-15
lines changed

x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/parser/EqlParser.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,14 @@ public void exitFunctionExpression(EqlBaseParser.FunctionExpressionContext conte
164164
case "arrayCount":
165165
case "arraySearch":
166166
throw new ParsingException(
167-
"unsupported function " + functionName,
167+
"Unsupported function [" + functionName + "]",
168168
null,
169169
token.getLine(),
170170
token.getCharPositionInLine());
171171

172172
default:
173173
throw new ParsingException(
174-
"unknown function " + functionName,
174+
"Unknown function [" + functionName + "]",
175175
null,
176176
token.getLine(),
177177
token.getCharPositionInLine());
@@ -182,7 +182,7 @@ public void exitFunctionExpression(EqlBaseParser.FunctionExpressionContext conte
182182
public void exitJoin(EqlBaseParser.JoinContext context) {
183183
Token token = context.JOIN().getSymbol();
184184
throw new ParsingException(
185-
"join is not supported",
185+
"Join is not supported",
186186
null,
187187
token.getLine(),
188188
token.getCharPositionInLine());
@@ -192,7 +192,7 @@ public void exitJoin(EqlBaseParser.JoinContext context) {
192192
public void exitPipe(EqlBaseParser.PipeContext context) {
193193
Token token = context.PIPE().getSymbol();
194194
throw new ParsingException(
195-
"pipes are not supported",
195+
"Pipes are not supported",
196196
null,
197197
token.getLine(),
198198
token.getCharPositionInLine());
@@ -202,7 +202,7 @@ public void exitPipe(EqlBaseParser.PipeContext context) {
202202
public void exitProcessCheck(EqlBaseParser.ProcessCheckContext context) {
203203
Token token = context.relationship;
204204
throw new ParsingException(
205-
"process relationships are not supported",
205+
"Process relationships are not supported",
206206
null,
207207
token.getLine(),
208208
token.getCharPositionInLine());
@@ -212,7 +212,7 @@ public void exitProcessCheck(EqlBaseParser.ProcessCheckContext context) {
212212
public void exitSequence(EqlBaseParser.SequenceContext context) {
213213
Token token = context.SEQUENCE().getSymbol();
214214
throw new ParsingException(
215-
"sequence is not supported",
215+
"Sequence is not supported",
216216
null,
217217
token.getLine(),
218218
token.getCharPositionInLine());
@@ -223,7 +223,7 @@ public void exitQualifiedName(EqlBaseParser.QualifiedNameContext context) {
223223
if (context.INTEGER_VALUE().size() > 0) {
224224
Token firstIndex = context.INTEGER_VALUE(0).getSymbol();
225225
throw new ParsingException(
226-
"array indexes are not supported",
226+
"Array indexes are not supported",
227227
null,
228228
firstIndex.getLine(),
229229
firstIndex.getCharPositionInLine());

x-pack/plugin/eql/src/test/java/org/elasticsearch/xpack/eql/analysis/VerifierTests.java

Lines changed: 303 additions & 6 deletions
Large diffs are not rendered by default.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"properties" : {
3+
"event_type" : {
4+
"type" : "keyword"
5+
},
6+
"user_name" : {
7+
"type" : "keyword"
8+
},
9+
"user_domain" : {
10+
"type" : "keyword"
11+
},
12+
"user_name_alias": {
13+
"type": "alias",
14+
"path": "user_name"
15+
}
16+
}
17+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"properties" : {
3+
"event_type" : {
4+
"type" : "keyword"
5+
},
6+
"blob" : {
7+
"type" : "binary"
8+
}
9+
}
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"properties" : {
3+
"event_type" : {
4+
"type" : "keyword"
5+
},
6+
"boolean_field" : {
7+
"type" : "boolean"
8+
}
9+
}
10+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"properties" : {
3+
"event_type" : {
4+
"type" : "keyword"
5+
},
6+
"date" : {
7+
"type" : "date"
8+
},
9+
"date_with_format" : {
10+
"type" : "date",
11+
"format" : "yyyy-MM-dd"
12+
},
13+
"date_with_multi_format" : {
14+
"type" : "date",
15+
"format" : "yyyy-MM-dd || basic_time || year"
16+
},
17+
"date_nanos_field" : {
18+
"type" : "date_nanos"
19+
}
20+
}
21+
}

x-pack/plugin/eql/src/test/resources/mapping-default.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,27 @@
5050
"ignore_above" : 256
5151
}
5252
}
53+
},
54+
"opcode" : {
55+
"type" : "long"
56+
},
57+
"file_name" : {
58+
"type" : "text",
59+
"fields" : {
60+
"keyword" : {
61+
"type" : "keyword",
62+
"ignore_above" : 256
63+
}
64+
}
65+
},
66+
"serial_event_id" : {
67+
"type" : "long"
68+
},
69+
"source_address" : {
70+
"type" : "ip"
71+
},
72+
"exit_code" : {
73+
"type" : "long"
5374
}
5475
}
5576
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"properties" : {
3+
"event_type" : {
4+
"type" : "keyword"
5+
},
6+
"location" : {
7+
"type" : "geo_point"
8+
},
9+
"site": {
10+
"type" : "geo_shape"
11+
}
12+
}
13+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"properties" : {
3+
"event_type" : {
4+
"type" : "keyword"
5+
},
6+
"ip_addr" : {
7+
"type" : "ip"
8+
}
9+
}
10+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"properties" : {
3+
"event_type" : {
4+
"type" : "keyword"
5+
},
6+
"serial_event_id" : {
7+
"type" : "long"
8+
},
9+
"parent_child" : {
10+
"type" : "join",
11+
"relations" : {
12+
"question" : "answer"
13+
}
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)