This is an automated email from the ASF dual-hosted git repository.

xvrl pushed a commit to branch jdk15-zk3.5
in repository https://gitbox.apache.org/repos/asf/druid.git

commit 903fa830c8ee62e44e5d8376958da7ed9dc9462c
Author: Xavier Léauté <[email protected]>
AuthorDate: Sat Mar 6 09:25:15 2021 -0800

    fix tests for Java 15 and above
    
    * JavaScript scripting support was removed in JDK 15: skip tests for
      those versions without the javascript script engine
    * fix flaky http client tests with JDK 15
---
 .../apache/druid/java/util/http/client/JankyServersTest.java  |  2 ++
 .../overlord/setup/JavaScriptWorkerSelectStrategyTest.java    | 11 +++++++++++
 .../router/JavaScriptTieredBrokerSelectorStrategyTest.java    | 10 ++++++++++
 3 files changed, 23 insertions(+)

diff --git 
a/core/src/test/java/org/apache/druid/java/util/http/client/JankyServersTest.java
 
b/core/src/test/java/org/apache/druid/java/util/http/client/JankyServersTest.java
index 3cc2d06..3d12cf7 100644
--- 
a/core/src/test/java/org/apache/druid/java/util/http/client/JankyServersTest.java
+++ 
b/core/src/test/java/org/apache/druid/java/util/http/client/JankyServersTest.java
@@ -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"));
   }
 
diff --git 
a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/setup/JavaScriptWorkerSelectStrategyTest.java
 
b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/setup/JavaScriptWorkerSelectStrategyTest.java
index cac81d1..8717edc 100644
--- 
a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/setup/JavaScriptWorkerSelectStrategyTest.java
+++ 
b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/setup/JavaScriptWorkerSelectStrategyTest.java
@@ -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
   {
diff --git 
a/server/src/test/java/org/apache/druid/server/router/JavaScriptTieredBrokerSelectorStrategyTest.java
 
b/server/src/test/java/org/apache/druid/server/router/JavaScriptTieredBrokerSelectorStrategyTest.java
index ec1ddb9..fa8e931 100644
--- 
a/server/src/test/java/org/apache/druid/server/router/JavaScriptTieredBrokerSelectorStrategyTest.java
+++ 
b/server/src/test/java/org/apache/druid/server/router/JavaScriptTieredBrokerSelectorStrategyTest.java
@@ -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
   {

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to