Skip to content

Commit 1fa2734

Browse files
committed
[TEST] Fix ElasticsearchExceptionTests
Some test failures can happen in ElasticsearchExceptionTests, this commit fixes them.
1 parent be96278 commit 1fa2734

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

core/src/test/java/org/elasticsearch/ElasticsearchExceptionTests.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -721,20 +721,17 @@ private static Tuple<Throwable, ElasticsearchException> randomExceptions() {
721721

722722
if (rarely()) {
723723
// Empty or null metadata are not printed out by the toXContent method
724-
actualException.addMetadata("ignored", randomBoolean() ? emptyList() : null);
724+
actualException.addMetadata("es.ignored", randomBoolean() ? emptyList() : null);
725725
}
726726
}
727727

728728
if (randomBoolean()) {
729729
int nbResources = randomIntBetween(1, 5);
730730
for (int i = 0; i < nbResources; i++) {
731731
String resourceType = "type_" + i;
732-
String[] resourceIds = null;
733-
if (frequently()) {
734-
resourceIds = new String[randomIntBetween(1, 3)];
735-
for (int j = 0; j < resourceIds.length; j++) {
736-
resourceIds[j] = frequently() ? randomAsciiOfLength(5) : "";
737-
}
732+
String[] resourceIds = new String[randomIntBetween(1, 3)];
733+
for (int j = 0; j < resourceIds.length; j++) {
734+
resourceIds[j] = frequently() ? randomAsciiOfLength(5) : "";
738735
}
739736
actualException.setResources(resourceType, resourceIds);
740737
expected.setResources(resourceType, resourceIds);

0 commit comments

Comments
 (0)