Skip to content

Commit 62cfd82

Browse files
authored
Add a test that exercises two little known paths (#137692)
1 parent 0a07db0 commit 62cfd82

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
@@ -74,3 +74,44 @@ teardown:
7474
- match: { _source.bytes_source_field: "1kb" }
7575
- match: { _source.conditional_field: "bar" }
7676
- is_false: _source.bytes_target_field
77+
78+
---
79+
"Test conditionals support params and statements":
80+
- do:
81+
ingest.put_pipeline:
82+
id: "my_pipeline"
83+
body: >
84+
{
85+
"description": "_description",
86+
"processors": [
87+
{
88+
"set" : {
89+
"if" : {
90+
"source": "def hit = params.success_codes.containsKey(ctx.code); return hit != null && hit == true;",
91+
"params": {
92+
"success_codes" : {
93+
"10": true,
94+
"20": true
95+
}
96+
}
97+
},
98+
"field" : "result",
99+
"value" : "success"
100+
}
101+
}
102+
]
103+
}
104+
- match: { acknowledged: true }
105+
106+
- do:
107+
index:
108+
index: test
109+
id: "1"
110+
pipeline: "my_pipeline"
111+
body: { code: "20" }
112+
113+
- do:
114+
get:
115+
index: test
116+
id: "1"
117+
- match: { _source.result: "success" }

0 commit comments

Comments
 (0)