150
150
151
151
import static java .util .Collections .emptyMap ;
152
152
import static org .elasticsearch .common .util .CollectionUtils .arrayAsArrayList ;
153
+ import static org .hamcrest .Matchers .anyOf ;
154
+ import static org .hamcrest .Matchers .contains ;
153
155
import static org .hamcrest .Matchers .empty ;
156
+ import static org .hamcrest .Matchers .emptyCollectionOf ;
154
157
import static org .hamcrest .Matchers .equalTo ;
155
158
import static org .hamcrest .Matchers .hasItem ;
159
+ import static org .hamcrest .Matchers .startsWith ;
156
160
157
161
/**
158
162
* Base testcase for randomized unit testing with Elasticsearch
@@ -631,6 +635,15 @@ public void log(StatusData data) {
631
635
});
632
636
}
633
637
638
+ // Tolerate the absence or otherwise denial of these specific lookup classes.
639
+ // At some future time, we should require the JDNI warning.
640
+ private static final List <String > LOG_4J_MSG_PREFIXES = org .elasticsearch .core .List .of (
641
+ "JNDI lookup class is not available because this JRE does not support JNDI. "
642
+ + "JNDI string lookups will not be available, continuing configuration." ,
643
+ "JMX runtime input lookup class is not available because this JRE does not support JMX. "
644
+ + "JMX lookups will not be available, continuing configuration. "
645
+ );
646
+
634
647
// separate method so that this can be checked again after suite scoped cluster is shut down
635
648
protected static void checkStaticState () throws Exception {
636
649
LeakTracker .INSTANCE .reportLeak ();
@@ -644,7 +657,11 @@ protected static void checkStaticState() throws Exception {
644
657
// StatusData instances to Strings as otherwise their toString output is useless
645
658
assertThat (
646
659
statusData .stream ().map (status -> status .getMessage ().getFormattedMessage ()).collect (Collectors .toList ()),
647
- empty ()
660
+ anyOf (
661
+ emptyCollectionOf (String .class ),
662
+ contains (startsWith (LOG_4J_MSG_PREFIXES .get (0 )), startsWith (LOG_4J_MSG_PREFIXES .get (1 ))),
663
+ contains (startsWith (LOG_4J_MSG_PREFIXES .get (1 )))
664
+ )
648
665
);
649
666
} finally {
650
667
// we clear the list so that status data from other tests do not interfere with tests within the same JVM
0 commit comments