|
@@ -147,9 +147,13 @@ import java.util.stream.Stream;
|
|
|
|
|
|
import static java.util.Collections.emptyMap;
|
|
|
import static org.elasticsearch.common.util.CollectionUtils.arrayAsArrayList;
|
|
|
+import static org.hamcrest.Matchers.anyOf;
|
|
|
+import static org.hamcrest.Matchers.contains;
|
|
|
import static org.hamcrest.Matchers.empty;
|
|
|
+import static org.hamcrest.Matchers.emptyCollectionOf;
|
|
|
import static org.hamcrest.Matchers.equalTo;
|
|
|
import static org.hamcrest.Matchers.hasItem;
|
|
|
+import static org.hamcrest.Matchers.startsWith;
|
|
|
|
|
|
/**
|
|
|
* Base testcase for randomized unit testing with Elasticsearch
|
|
@@ -600,6 +604,15 @@ public abstract class ESTestCase extends LuceneTestCase {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ // Tolerate the absence or otherwise denial of these specific lookup classes.
|
|
|
+ // At some future time, we should require the JDNI warning.
|
|
|
+ private static final List<String> LOG_4J_MSG_PREFIXES = List.of(
|
|
|
+ "JNDI lookup class is not available because this JRE does not support JNDI. "
|
|
|
+ + "JNDI string lookups will not be available, continuing configuration.",
|
|
|
+ "JMX runtime input lookup class is not available because this JRE does not support JMX. "
|
|
|
+ + "JMX lookups will not be available, continuing configuration. "
|
|
|
+ );
|
|
|
+
|
|
|
// separate method so that this can be checked again after suite scoped cluster is shut down
|
|
|
protected static void checkStaticState() throws Exception {
|
|
|
LeakTracker.INSTANCE.reportLeak();
|
|
@@ -613,7 +626,10 @@ public abstract class ESTestCase extends LuceneTestCase {
|
|
|
// StatusData instances to Strings as otherwise their toString output is useless
|
|
|
assertThat(
|
|
|
statusData.stream().map(status -> status.getMessage().getFormattedMessage()).collect(Collectors.toList()),
|
|
|
- empty()
|
|
|
+ anyOf(
|
|
|
+ emptyCollectionOf(String.class),
|
|
|
+ contains(startsWith(LOG_4J_MSG_PREFIXES.get(0)), startsWith(LOG_4J_MSG_PREFIXES.get(1)))
|
|
|
+ )
|
|
|
);
|
|
|
} finally {
|
|
|
// we clear the list so that status data from other tests do not interfere with tests within the same JVM
|