You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/11/14 15:30:09 UTC
[lucene-solr] branch reference_impl_dev updated: @1196 Test harden.
This is an automated email from the ASF dual-hosted git repository.
markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/reference_impl_dev by this push:
new ce17a50 @1196 Test harden.
ce17a50 is described below
commit ce17a504f4ba29544816bc8eb10e7c19a28919fa
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Sat Nov 14 09:26:12 2020 -0600
@1196 Test harden.
---
.../apache/solr/cloud/TestDownShardTolerantSearch.java | 1 +
.../apache/solr/handler/admin/LoggingHandlerTest.java | 18 ++++++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestDownShardTolerantSearch.java b/solr/core/src/test/org/apache/solr/cloud/TestDownShardTolerantSearch.java
index f607765..cbd4cbd 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestDownShardTolerantSearch.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestDownShardTolerantSearch.java
@@ -77,6 +77,7 @@ public class TestDownShardTolerantSearch extends SolrCloudTestCase {
try {
response = cluster.getSolrClient().query("tolerant", new SolrQuery("*:*").setRows(1).setParam(ShardParams.SHARDS_TOLERANT, true));
} catch (BaseHttpSolrClient.RemoteExecutionException e2) {
+ log.info("Live nodes is {}", cluster.getSolrClient().getZkStateReader().getLiveNodes());
// a remote node we are proxied too may still think this is live, try again
response = cluster.getSolrClient().query("tolerant", new SolrQuery("*:*").setRows(1).setParam(ShardParams.SHARDS_TOLERANT, true));
}
diff --git a/solr/core/src/test/org/apache/solr/handler/admin/LoggingHandlerTest.java b/solr/core/src/test/org/apache/solr/handler/admin/LoggingHandlerTest.java
index 82405ef..aa2bae3 100644
--- a/solr/core/src/test/org/apache/solr/handler/admin/LoggingHandlerTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/admin/LoggingHandlerTest.java
@@ -50,6 +50,7 @@ public class LoggingHandlerTest extends SolrTestCaseJ4 {
// log level that doesn't exist
protected static Map<String, Level> savedClassLogLevels = new HashMap<>();
+ private static boolean firstInit;
@BeforeClass
public static void beforeClass() throws Exception {
@@ -88,11 +89,14 @@ public class LoggingHandlerTest extends SolrTestCaseJ4 {
public void restoreMethodLogLevels() {
LogLevel.Configurer.restoreLogLevels(savedMethodLogLevels);
savedMethodLogLevels.clear();
+ firstInit = false;
}
@Test
public void testLogLevelHandlerOutput() throws Exception {
-
+
+ assumeTrue("Only run this the first time in a JVM", firstInit);
+
// sanity check our setup...
assertNotNull(this.getClass().getAnnotation(LogLevel.class));
final String annotationConfig = this.getClass().getAnnotation(LogLevel.class).value();
@@ -102,14 +106,17 @@ public class LoggingHandlerTest extends SolrTestCaseJ4 {
assertEquals(Level.DEBUG, LogManager.getLogger( CLASS_LOGGER_NAME ).getLevel());
- final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
+ final LoggerContext ctx = (LoggerContext) LogManager.getContext(true);
final Configuration config = ctx.getConfiguration();
assertEquals("Unexpected config for " + PARENT_LOGGER_NAME + " ... expected 'root' config",
config.getRootLogger(),
config.getLoggerConfig(PARENT_LOGGER_NAME));
+ // only works first run
+
assertEquals(Level.DEBUG, config.getLoggerConfig(CLASS_LOGGER_NAME).getLevel());
+
assertQ("Show Log Levels OK",
req(CommonParams.QT,"/admin/logging")
,"//arr[@name='loggers']/lst/str[.='"+CLASS_LOGGER_NAME+"']/../str[@name='level'][.='DEBUG']"
@@ -121,8 +128,10 @@ public class LoggingHandlerTest extends SolrTestCaseJ4 {
"set", PARENT_LOGGER_NAME+":TRACE")
,"//arr[@name='loggers']/lst/str[.='"+PARENT_LOGGER_NAME+"']/../str[@name='level'][.='TRACE']"
);
+
assertEquals(Level.TRACE, config.getLoggerConfig(PARENT_LOGGER_NAME).getLevel());
assertEquals(Level.DEBUG, config.getLoggerConfig(CLASS_LOGGER_NAME).getLevel());
+
// NOTE: LoggeringHandler doesn't actually "remove" the LoggerConfig, ...
// evidently so people using they UI can see that it was explicitly turned "OFF" ?
@@ -131,9 +140,14 @@ public class LoggingHandlerTest extends SolrTestCaseJ4 {
"set", PARENT_LOGGER_NAME+":null")
,"//arr[@name='loggers']/lst/str[.='"+PARENT_LOGGER_NAME+"']/../str[@name='level'][.='OFF']"
);
+
+
assertEquals(Level.OFF, config.getLoggerConfig(PARENT_LOGGER_NAME).getLevel());
assertEquals(Level.DEBUG, config.getLoggerConfig(CLASS_LOGGER_NAME).getLevel());
+
+ ctx.close();
+
}
}