Skip to content

Commit da2d413

Browse files
joegalloKubik42
authored andcommitted
Add a test for two little known conditional processor paths (elastic#137645)
1 parent 98b3193 commit da2d413

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

modules/ingest-common/src/yamlRestTest/resources/rest-api-spec/test/ingest/210_conditional_processor.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,44 @@ teardown:
221221
index: test
222222
id: "2"
223223
catch: missing
224+
225+
---
226+
"Test conditionals support params and statements":
227+
- do:
228+
ingest.put_pipeline:
229+
id: "my_pipeline"
230+
body: >
231+
{
232+
"description": "_description",
233+
"processors": [
234+
{
235+
"set" : {
236+
"if" : {
237+
"source": "def hit = params.success_codes.containsKey(ctx.code); return hit != null && hit == true;",
238+
"params": {
239+
"success_codes" : {
240+
"10": true,
241+
"20": true
242+
}
243+
}
244+
},
245+
"field" : "result",
246+
"value" : "success"
247+
}
248+
}
249+
]
250+
}
251+
- match: { acknowledged: true }
252+
253+
- do:
254+
index:
255+
index: test
256+
id: "1"
257+
pipeline: "my_pipeline"
258+
body: { code: "20" }
259+
260+
- do:
261+
get:
262+
index: test
263+
id: "1"
264+
- match: { _source.result: "success" }

0 commit comments

Comments
 (0)