Skip to content

Commit

Permalink
Avoid noisy errors in testSyntheticSourceKeepArrays (elastic#114391)
Browse files Browse the repository at this point in the history
* Minimize storing array source

* restrict to fields

* revert changes for `addIgnoredFieldFromContext`

* fix test

* spotless

* count nulls

* Avoid noisy errors in testSyntheticSourceKeepArrays

* update

* update

* update

* update
  • Loading branch information
kkrik-es authored Oct 9, 2024
1 parent e97aaa8 commit f6bf506
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,7 @@ public void testSyntheticSourceKeepArrays() throws IOException {
b.endObject();
}));

int elementCount = randomIntBetween(1, 5);
int elementCount = randomIntBetween(2, 5);
CheckedConsumer<XContentBuilder, IOException> buildInput = (XContentBuilder builder) -> {
example.buildInputArray(builder, elementCount);
};
Expand All @@ -1581,10 +1581,7 @@ public void testSyntheticSourceKeepArrays() throws IOException {
builder.endObject();
String expected = Strings.toString(builder);
String actual = syntheticSource(mapperAll, buildInput);
// Check for single-element array, the array source is not stored in this case.
if (expected.replace("[", "").replace("]", "").equals(actual) == false) {
assertThat(actual, equalTo(expected));
}
assertThat(actual, equalTo(expected));
}

@Override
Expand Down

0 comments on commit f6bf506

Please sign in to comment.