From 1fa2734566716391de3a88333e5e88f7a6cb6d1d Mon Sep 17 00:00:00 2001 From: Tanguy Leroux Date: Thu, 26 Jan 2017 16:30:10 +0100 Subject: [PATCH] [TEST] Fix ElasticsearchExceptionTests Some test failures can happen in ElasticsearchExceptionTests, this commit fixes them. --- .../elasticsearch/ElasticsearchExceptionTests.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/core/src/test/java/org/elasticsearch/ElasticsearchExceptionTests.java b/core/src/test/java/org/elasticsearch/ElasticsearchExceptionTests.java index 8f209f397b1..71ef7710e1c 100644 --- a/core/src/test/java/org/elasticsearch/ElasticsearchExceptionTests.java +++ b/core/src/test/java/org/elasticsearch/ElasticsearchExceptionTests.java @@ -721,7 +721,7 @@ public class ElasticsearchExceptionTests extends ESTestCase { if (rarely()) { // Empty or null metadata are not printed out by the toXContent method - actualException.addMetadata("ignored", randomBoolean() ? emptyList() : null); + actualException.addMetadata("es.ignored", randomBoolean() ? emptyList() : null); } } @@ -729,12 +729,9 @@ public class ElasticsearchExceptionTests extends ESTestCase { int nbResources = randomIntBetween(1, 5); for (int i = 0; i < nbResources; i++) { String resourceType = "type_" + i; - String[] resourceIds = null; - if (frequently()) { - resourceIds = new String[randomIntBetween(1, 3)]; - for (int j = 0; j < resourceIds.length; j++) { - resourceIds[j] = frequently() ? randomAsciiOfLength(5) : ""; - } + String[] resourceIds = new String[randomIntBetween(1, 3)]; + for (int j = 0; j < resourceIds.length; j++) { + resourceIds[j] = frequently() ? randomAsciiOfLength(5) : ""; } actualException.setResources(resourceType, resourceIds); expected.setResources(resourceType, resourceIds);