Skip to content

Commit de74536

Browse files
authored
Fix and unmute append processor tests (elastic#136687)
1 parent 9de36af commit de74536

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/AppendProcessorTests.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import static org.hamcrest.Matchers.equalTo;
3535
import static org.hamcrest.Matchers.instanceOf;
3636
import static org.hamcrest.Matchers.not;
37+
import static org.hamcrest.Matchers.nullValue;
3738
import static org.hamcrest.Matchers.sameInstance;
3839

3940
public class AppendProcessorTests extends ESTestCase {
@@ -84,7 +85,7 @@ public void testAppendValuesToNonExistingList() throws Exception {
8485
values.add(value);
8586
appendProcessor = createAppendProcessor(field, value, null, true, false);
8687
} else {
87-
int valuesSize = randomIntBetween(0, 10);
88+
int valuesSize = randomIntBetween(1, 10);
8889
for (int i = 0; i < valuesSize; i++) {
8990
values.add(scalar.randomValue());
9091
}
@@ -108,7 +109,7 @@ public void testConvertScalarToList() throws Exception {
108109
values.add(value);
109110
appendProcessor = createAppendProcessor(field, value, null, true, false);
110111
} else {
111-
int valuesSize = randomIntBetween(0, 10);
112+
int valuesSize = randomIntBetween(1, 10);
112113
for (int i = 0; i < valuesSize; i++) {
113114
values.add(scalar.randomValue());
114115
}
@@ -295,9 +296,13 @@ public void testAppendingToNonExistingListEmptyStringAndEmptyValuesDisallowed()
295296
appendProcessor = createAppendProcessor(field, allValues, null, true, true);
296297
}
297298
appendProcessor.execute(ingestDocument);
298-
List<?> list = ingestDocument.getFieldValue(field, List.class);
299+
List<?> list = ingestDocument.getFieldValue(field, List.class, true);
299300
assertThat(list, not(sameInstance(values)));
300-
assertThat(list, equalTo(values));
301+
if (values.isEmpty()) {
302+
assertThat(list, nullValue());
303+
} else {
304+
assertThat(list, equalTo(values));
305+
}
301306
}
302307

303308
public void testCopyFromOtherFieldSimple() throws Exception {

muted-tests.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -588,15 +588,6 @@ tests:
588588
- class: org.elasticsearch.xpack.core.HealthApiFeatureSetUsageTests
589589
method: testEqualsAndHashcode
590590
issue: https://github.com/elastic/elasticsearch/issues/136648
591-
- class: org.elasticsearch.ingest.common.AppendProcessorTests
592-
method: testAppendingToNonExistingListEmptyStringAndEmptyValuesDisallowed
593-
issue: https://github.com/elastic/elasticsearch/issues/136657
594-
- class: org.elasticsearch.ingest.common.AppendProcessorTests
595-
method: testAppendValuesToNonExistingList
596-
issue: https://github.com/elastic/elasticsearch/issues/136662
597-
- class: org.elasticsearch.ingest.common.AppendProcessorTests
598-
method: testConvertScalarToList
599-
issue: https://github.com/elastic/elasticsearch/issues/136667
600591
- class: org.elasticsearch.xpack.downsample.ILMDownsampleDisruptionIT
601592
method: testILMDownsampleRollingRestart
602593
issue: https://github.com/elastic/elasticsearch/issues/136585

0 commit comments

Comments
 (0)