Fix unit tests and GC settings for Java 15 (#11074)

* JavaScript script engine support was removed in JDK 15: skip those tests for JDKs without it
* Fix flaky HTTP client tests with Java 15
* Switch from CMS to G1GC in integration tests, since CMS is no longer available in JDK 15
This commit is contained in:
Xavier Léauté 2021-04-08 10:33:37 -07:00 committed by GitHub
parent fb6751fa45
commit 15bdd6bc2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 3 deletions

View File

@ -41,6 +41,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.net.URL;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
@ -298,6 +299,7 @@ public class JankyServersTest
public boolean isChannelClosedException(Throwable e)
{
return e instanceof ChannelException ||
(e instanceof SocketException && e.getMessage().contains("Connection reset")) ||
(e instanceof IOException && e.getMessage().contains("Connection reset by peer"));
}

View File

@ -32,10 +32,14 @@ import org.easymock.EasyMock;
import org.hamcrest.CoreMatchers;
import org.joda.time.Period;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import javax.script.ScriptEngineManager;
public class JavaScriptWorkerSelectStrategyTest
{
@Rule
@ -71,6 +75,13 @@ public class JavaScriptWorkerSelectStrategyTest
JavaScriptConfig.getEnabledInstance()
);
@Before
public void checkJdkCompatibility()
{
// skip tests for newer JDKs without javascript support
Assume.assumeNotNull(new ScriptEngineManager().getEngineByName("javascript"));
}
@Test
public void testSerde() throws Exception
{

View File

@ -21,7 +21,7 @@ DRUID_SERVICE=router
DRUID_LOG_PATH=/shared/logs/router-custom-check-tls.log
# JAVA OPTS
SERVICE_DRUID_JAVA_OPTS=-server -Xmx64m -Xms64m -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5003
SERVICE_DRUID_JAVA_OPTS=-server -Xmx64m -Xms64m -XX:+UseG1GC -XX:+PrintGCDetails -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5003
# Druid configs
druid_plaintextPort=8891

View File

@ -21,7 +21,7 @@ DRUID_SERVICE=router
DRUID_LOG_PATH=/shared/logs/router-no-client-auth-tls.log
# JAVA OPTS
SERVICE_DRUID_JAVA_OPTS=-server -Xmx64m -Xms64m -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5002
SERVICE_DRUID_JAVA_OPTS=-server -Xmx64m -Xms64m -XX:+UseG1GC -XX:+PrintGCDetails -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5002
# Druid configs
druid_plaintextPort=8890

View File

@ -21,7 +21,7 @@ DRUID_SERVICE=router
DRUID_LOG_PATH=/shared/logs/router-permissive-tls.log
# JAVA OPTS
SERVICE_DRUID_JAVA_OPTS=-server -Xmx64m -Xms64m -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5001
SERVICE_DRUID_JAVA_OPTS=-server -Xmx64m -Xms64m -XX:+UseG1GC -XX:+PrintGCDetails -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5001
# Druid configs
druid_plaintextPort=8889

View File

@ -32,10 +32,13 @@ import org.apache.druid.query.aggregation.LongSumAggregatorFactory;
import org.apache.druid.query.topn.TopNQueryBuilder;
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import javax.script.ScriptEngineManager;
import java.util.LinkedHashMap;
public class JavaScriptTieredBrokerSelectorStrategyTest
@ -48,6 +51,13 @@ public class JavaScriptTieredBrokerSelectorStrategyTest
JavaScriptConfig.getEnabledInstance()
);
@Before
public void checkJdkCompatibility()
{
// skip tests for newer JDKs without javascript support
Assume.assumeNotNull(new ScriptEngineManager().getEngineByName("javascript"));
}
@Test
public void testSerde() throws Exception
{