Revert "[TEST] use logger level from test class annotation also in external nodes"
This reverts commit 4604a68bef
.
This commit is contained in:
parent
0fcb466555
commit
06e907d99e
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.search.SearchResponse;
|
|||
import org.elasticsearch.common.geo.GeoPoint;
|
||||
import org.elasticsearch.common.lucene.search.function.FieldValueFactorFunction;
|
||||
import org.elasticsearch.test.ElasticsearchBackwardsCompatIntegrationTest;
|
||||
import org.elasticsearch.test.junit.annotations.TestLogging;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -41,7 +40,6 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*;
|
|||
|
||||
/**
|
||||
*/
|
||||
@TestLogging("action.search:TRACE")
|
||||
public class FunctionScoreBackwardCompatibilityTests extends ElasticsearchBackwardsCompatIntegrationTest {
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,13 +24,10 @@ import org.elasticsearch.cluster.ClusterState;
|
|||
import org.elasticsearch.cluster.routing.IndexRoutingTable;
|
||||
import org.elasticsearch.cluster.routing.IndexShardRoutingTable;
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.regex.Regex;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.indices.recovery.RecoverySettings;
|
||||
import org.elasticsearch.test.junit.annotations.TestLogging;
|
||||
import org.elasticsearch.test.junit.listeners.LoggingListener;
|
||||
import org.elasticsearch.transport.Transport;
|
||||
import org.elasticsearch.transport.TransportModule;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
@ -40,8 +37,6 @@ import org.junit.Ignore;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
|
@ -114,14 +109,11 @@ public abstract class ElasticsearchBackwardsCompatIntegrationTest extends Elasti
|
|||
}
|
||||
|
||||
protected TestCluster buildTestCluster(Scope scope, long seed) throws IOException {
|
||||
TestLogging logging = getClass().getAnnotation(TestLogging.class);
|
||||
final Map<String, String> loggerLevels = LoggingListener.getLoggersAndLevelsFromAnnotation(logging);
|
||||
TestCluster cluster = super.buildTestCluster(scope, seed);
|
||||
|
||||
ExternalNode externalNode = new ExternalNode(backwardsCompatibilityPath(), randomLong(), new SettingsSource() {
|
||||
@Override
|
||||
public Settings node(int nodeOrdinal) {
|
||||
return externalNodeSettings(nodeOrdinal, loggerLevels);
|
||||
return externalNodeSettings(nodeOrdinal);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -155,17 +147,10 @@ public abstract class ElasticsearchBackwardsCompatIntegrationTest extends Elasti
|
|||
return ExternalNode.REQUIRED_SETTINGS;
|
||||
}
|
||||
|
||||
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return nodeSettings(nodeOrdinal, new HashMap<String, String>());
|
||||
}
|
||||
protected Settings nodeSettings(int nodeOrdinal, Map<String, String> loggerLevels) {
|
||||
ImmutableSettings.Builder builder = ImmutableSettings.builder().put(requiredSettings())
|
||||
.put(TransportModule.TRANSPORT_TYPE_KEY, NettyTransport.class.getName()) // run same transport / disco as external
|
||||
.put(TransportModule.TRANSPORT_SERVICE_TYPE_KEY, TransportService.class.getName());
|
||||
for (Map.Entry<String, String> level : loggerLevels.entrySet()) {
|
||||
builder.put("logger." + level.getKey(), level.getValue());
|
||||
}
|
||||
if (compatibilityVersion().before(Version.V_1_3_2)) {
|
||||
// if we test against nodes before 1.3.2 we disable all the compression due to a known bug
|
||||
// see #7210
|
||||
|
@ -189,11 +174,7 @@ public abstract class ElasticsearchBackwardsCompatIntegrationTest extends Elasti
|
|||
}
|
||||
}
|
||||
|
||||
protected Settings externalNodeSettings(int nodeOrdinal, Map<String, String> loggerLevels) {
|
||||
return nodeSettings(nodeOrdinal, loggerLevels);
|
||||
}
|
||||
|
||||
protected Settings externalNodeSettings(int nodeOrdinal) {
|
||||
return nodeSettings(nodeOrdinal, new HashMap<String, String>());
|
||||
return nodeSettings(nodeOrdinal);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -288,7 +288,7 @@ public final class InternalTestCluster extends TestCluster {
|
|||
builder.put("logger.level", System.getProperty("es.logger.level"));
|
||||
}
|
||||
if (Strings.hasLength(System.getProperty("es.logger.prefix"))) {
|
||||
builder.put("logger.prefix", System.getProperty("es.logger.prefix"));
|
||||
builder.put("logger.prefix", System.getProperty("es.logger.level"));
|
||||
}
|
||||
// Default the watermarks to absurdly low to prevent the tests
|
||||
// from failing on nodes without enough disk space
|
||||
|
|
|
@ -76,18 +76,6 @@ public class LoggingListener extends RunListener {
|
|||
}
|
||||
|
||||
private Map<String, String> processTestLogging(TestLogging testLogging) {
|
||||
Map<String, String> map = getLoggersAndLevelsFromAnnotation(testLogging);
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
ESLogger esLogger = resolveLogger(entry.getKey());
|
||||
esLogger.setLevel(entry.getValue());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public static Map<String, String> getLoggersAndLevelsFromAnnotation(TestLogging testLogging) {
|
||||
if (testLogging == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -98,7 +86,9 @@ public class LoggingListener extends RunListener {
|
|||
if (loggerAndLevelArray.length >=2) {
|
||||
String loggerName = loggerAndLevelArray[0];
|
||||
String level = loggerAndLevelArray[1];
|
||||
map.put(loggerName, level);
|
||||
ESLogger esLogger = resolveLogger(loggerName);
|
||||
map.put(loggerName, esLogger.getLevel());
|
||||
esLogger.setLevel(level);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
|
|
Loading…
Reference in New Issue