Skip to content

Commit 6361a9e

Browse files
committed
Add some rest tests
1 parent 5ba1426 commit 6361a9e

File tree

1 file changed

+153
-0
lines changed

1 file changed

+153
-0
lines changed
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
---
2+
setup:
3+
- requires:
4+
cluster_features: [ "ingest.append.ignore_empty_values" ]
5+
reason: "The ignore_empty_values option of the append processor is new"
6+
- do:
7+
ingest.put_pipeline:
8+
id: "test-pipeline-1"
9+
body: >
10+
{
11+
"processors": [
12+
{
13+
"append": {
14+
"field": "dest",
15+
"copy_from": "src",
16+
"ignore_empty_values": true
17+
}
18+
},
19+
{
20+
"remove": {
21+
"field": "src",
22+
"ignore_missing": true
23+
}
24+
}
25+
]
26+
}
27+
- do:
28+
indices.create:
29+
index: "test-some-index"
30+
31+
---
32+
teardown:
33+
- do:
34+
indices.delete:
35+
index: "test-some-index"
36+
ignore_unavailable: true
37+
- do:
38+
ingest.delete_pipeline:
39+
id: "test-pipeline-1"
40+
ignore: 404
41+
42+
---
43+
"A missing copy_from value is ignored":
44+
- do:
45+
index:
46+
index: test-some-index
47+
id: 1
48+
pipeline: test-pipeline-1
49+
body: >
50+
{
51+
"dest": [1]
52+
}
53+
54+
- do:
55+
get:
56+
index: test-some-index
57+
id: "1"
58+
- match: { _source.dest: [1] }
59+
60+
---
61+
"A null copy_from value is ignored":
62+
- do:
63+
index:
64+
index: test-some-index
65+
id: 1
66+
pipeline: test-pipeline-1
67+
body: >
68+
{
69+
"src": null,
70+
"dest": [1]
71+
}
72+
73+
- do:
74+
get:
75+
index: test-some-index
76+
id: "1"
77+
- match: { _source.dest: [1] }
78+
79+
---
80+
"An empty string copy_from value is ignored":
81+
- do:
82+
index:
83+
index: test-some-index
84+
id: 1
85+
pipeline: test-pipeline-1
86+
body: >
87+
{
88+
"src": "",
89+
"dest": [1]
90+
}
91+
92+
- do:
93+
get:
94+
index: test-some-index
95+
id: "1"
96+
- match: { _source.dest: [1] }
97+
98+
---
99+
"An empty array copy_from value is ignored":
100+
- do:
101+
index:
102+
index: test-some-index
103+
id: 1
104+
pipeline: test-pipeline-1
105+
body: >
106+
{
107+
"src": [],
108+
"dest": [1]
109+
}
110+
111+
- do:
112+
get:
113+
index: test-some-index
114+
id: "1"
115+
- match: { _source.dest: [1] }
116+
117+
---
118+
"A non-null value is copied":
119+
- do:
120+
index:
121+
index: test-some-index
122+
id: 1
123+
pipeline: test-pipeline-1
124+
body: >
125+
{
126+
"src": 2,
127+
"dest": [1]
128+
}
129+
130+
- do:
131+
get:
132+
index: test-some-index
133+
id: "1"
134+
- match: { _source.dest: [1, 2] }
135+
136+
---
137+
"Empty strings and nulls are ignored in an array":
138+
- do:
139+
index:
140+
index: test-some-index
141+
id: 1
142+
pipeline: test-pipeline-1
143+
body: >
144+
{
145+
"src": ["", 2, null, 3],
146+
"dest": [1]
147+
}
148+
149+
- do:
150+
get:
151+
index: test-some-index
152+
id: "1"
153+
- match: { _source.dest: [1, 2, 3] }

0 commit comments

Comments
 (0)