Merge pull request elastic/elasticsearch#1707 from ywelsch/enhance/forbid-sysout-for-tests
Remove System.out.println and Throwable.printStackTrace from tests Original commit: elastic/x-pack-elasticsearch@02aa9c7e28
This commit is contained in:
commit
85b3f13f29
|
@ -8,11 +8,13 @@ package org.elasticsearch.bench;
|
|||
import org.elasticsearch.common.Randomness;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.generators.RandomStrings;
|
||||
import org.elasticsearch.common.SuppressForbidden;
|
||||
import org.elasticsearch.common.metrics.MeanMetric;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.shield.authc.support.Hasher;
|
||||
import org.elasticsearch.shield.authc.support.SecuredString;
|
||||
|
||||
@SuppressForbidden(reason = "benchmark")
|
||||
public class HasherBenchmark {
|
||||
|
||||
private static final int WARMING_ITERS = 1000;
|
||||
|
@ -63,6 +65,7 @@ public class HasherBenchmark {
|
|||
return metrics;
|
||||
}
|
||||
|
||||
@SuppressForbidden(reason = "benchmark")
|
||||
private static class Metrics {
|
||||
|
||||
final String name;
|
||||
|
|
|
@ -42,7 +42,7 @@ public class EmailServer {
|
|||
|
||||
private final SMTPServer server;
|
||||
|
||||
public EmailServer(String host, int port, final String username, final String password) {
|
||||
public EmailServer(String host, int port, final String username, final String password, final ESLogger logger) {
|
||||
server = new SMTPServer(new SimpleMessageListenerAdapter(new SimpleMessageListener() {
|
||||
@Override
|
||||
public boolean accept(String from, String recipient) {
|
||||
|
@ -58,8 +58,8 @@ public class EmailServer {
|
|||
try {
|
||||
listener.on(msg);
|
||||
} catch (Exception e) {
|
||||
logger.error("Unexpected failure", e);
|
||||
fail(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} catch (MessagingException me) {
|
||||
|
@ -104,7 +104,7 @@ public class EmailServer {
|
|||
@Override
|
||||
public boolean onPortNumber(int port) {
|
||||
try {
|
||||
EmailServer server = new EmailServer("localhost", port, username, password);
|
||||
EmailServer server = new EmailServer("localhost", port, username, password, logger);
|
||||
server.start();
|
||||
emailServer.set(server);
|
||||
return true;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
package org.elasticsearch.watcher.test.bench;
|
||||
|
||||
import org.elasticsearch.common.Randomness;
|
||||
import org.elasticsearch.common.SuppressForbidden;
|
||||
import org.elasticsearch.common.metrics.MeanMetric;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.watcher.support.clock.SystemClock;
|
||||
|
@ -33,6 +34,7 @@ import static org.elasticsearch.watcher.trigger.schedule.Schedules.interval;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@SuppressForbidden(reason = "benchmark")
|
||||
public class ScheduleEngineTriggerBenchmark {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
|
|
@ -55,6 +55,7 @@ import static org.elasticsearch.watcher.trigger.schedule.Schedules.interval;
|
|||
|
||||
/**
|
||||
*/
|
||||
@SuppressForbidden(reason = "benchmark")
|
||||
public class WatcherScheduleEngineBenchmark {
|
||||
|
||||
private final static Settings SETTINGS = Settings.builder()
|
||||
|
@ -64,7 +65,6 @@ public class WatcherScheduleEngineBenchmark {
|
|||
.put("http.cors.enabled", true)
|
||||
.build();
|
||||
|
||||
@SuppressForbidden(reason = "not really code or a test")
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.setProperty("es.logger.prefix", "");
|
||||
|
||||
|
@ -252,6 +252,7 @@ public class WatcherScheduleEngineBenchmark {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressForbidden(reason = "benchmark")
|
||||
private static class BenchStats {
|
||||
|
||||
private final String name;
|
||||
|
|
Loading…
Reference in New Issue