Skip to content

Commit

Permalink
More fixes about running tests on JDK11 (apache#9893)
Browse files Browse the repository at this point in the history
### Motivation
When you are running tests on JDK11 you encounter a lot of issues.
This patch includes a list of minor fixes that can be grouped.

Master issue apache#9578 

### Modifications
- Upgrade Mockito to latest version
- Add  "--add-opens java.base/jdk.internal.loader=ALL-UNNAMED" in order to allow PowerMock to work
- add JAXB into jcloud provider (we already have it on the classpath in production, it is only in order to let tests run)
- Upgrade HDFS minicluster to 3.3.0
- Pin netty-codec-http dependency to the same version of netty (inherited from HDFS client)
- Use the same version of Jetty for hdfs-offload (old version does not work with JDK11)
  • Loading branch information
eolivelli committed Mar 14, 2021
1 parent c7a237a commit c94d782
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 9 deletions.
17 changes: 14 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ flexible messaging model and an intuitive client API.</description>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<test.additional.args></test.additional.args>
<testReuseFork>true</testReuseFork>
<testForkCount>4</testForkCount>
<testRealAWS>false</testRealAWS>
Expand Down Expand Up @@ -143,8 +144,7 @@ flexible messaging model and an intuitive client API.</description>
<postgresql-jdbc.version>42.2.12</postgresql-jdbc.version>
<clickhouse-jdbc.version>0.2.4</clickhouse-jdbc.version>
<mariadb-jdbc.version>2.6.0</mariadb-jdbc.version>
<hdfs-offload-version3>3.2.0</hdfs-offload-version3>
<org.eclipse.jetty-hdfs-offload>9.3.24.v20180605</org.eclipse.jetty-hdfs-offload>
<hdfs-offload-version3>3.3.0</hdfs-offload-version3>
<elasticsearch.version>7.9.1</elasticsearch.version>
<presto.version>332</presto.version>
<scala.binary.version>2.11</scala.binary.version>
Expand Down Expand Up @@ -192,7 +192,7 @@ flexible messaging model and an intuitive client API.</description>
<testcontainers.version>1.15.1</testcontainers.version>
<kerby.version>1.1.1</kerby.version>
<testng.version>7.3.0</testng.version>
<mockito.version>3.0.0</mockito.version>
<mockito.version>3.8.0</mockito.version>
<powermock.version>2.0.9</powermock.version>
<javassist.version>3.25.0-GA</javassist.version>
<failsafe.version>2.3.1</failsafe.version>
Expand Down Expand Up @@ -1154,6 +1154,7 @@ flexible messaging model and an intuitive client API.</description>
-Dpulsar.allocator.pooled=false
-Dpulsar.allocator.leak_detection=Advanced
-Dpulsar.allocator.exit_on_oom=false
${test.additional.args}
</argLine>
<reuseForks>${testReuseFork}</reuseForks>
<forkCount>${testForkCount}</forkCount>
Expand Down Expand Up @@ -1626,6 +1627,15 @@ flexible messaging model and an intuitive client API.</description>
</build>

<profiles>
<profile>
<id>jdk11-tests</id>
<activation>
<jdk>[11,)</jdk>
</activation>
<properties>
<test.additional.args> --add-opens java.base/jdk.internal.loader=ALL-UNNAMED </test.additional.args>
</properties>
</profile>
<profile>
<id>coverage</id>
<build>
Expand Down Expand Up @@ -1757,6 +1767,7 @@ flexible messaging model and an intuitive client API.</description>
<id>main</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>[8,)</jdk>
</activation>
<modules>
<module>buildtools</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
import org.apache.pulsar.common.naming.TopicName;
import org.apache.pulsar.common.partition.PartitionedTopicMetadata;
import org.apache.pulsar.common.util.netty.EventLoopUtil;
import org.mockito.internal.util.reflection.FieldSetter;
import org.powermock.reflect.Whitebox;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -114,8 +114,8 @@ public void testConsumerIsClosed() throws Exception {
.thenReturn(CompletableFuture.completedFuture(mock(ProducerResponse.class)));
when(pool.getConnection(any(InetSocketAddress.class), any(InetSocketAddress.class)))
.thenReturn(CompletableFuture.completedFuture(cnx));
FieldSetter.setField(clientImpl, clientImpl.getClass().getDeclaredField("cnxPool"), pool);
FieldSetter.setField(clientImpl, clientImpl.getClass().getDeclaredField("lookup"), lookup);
Whitebox.setInternalState(clientImpl, "cnxPool", pool);
Whitebox.setInternalState(clientImpl, "lookup", lookup);

List<ConsumerBase<byte[]>> consumers = new ArrayList<>();
/**
Expand Down
12 changes: 9 additions & 3 deletions tiered-storage/file-system/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,28 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http</artifactId>
</dependency>

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${org.eclipse.jetty-hdfs-offload}</version>
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${org.eclipse.jetty-hdfs-offload}</version>
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${org.eclipse.jetty-hdfs-offload}</version>
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
19 changes: 19 additions & 0 deletions tiered-storage/jcloud/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,25 @@
<version>${jclouds.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<exclusions>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
</exclusion>
</exclusions>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
<scope>runtime</scope>
</dependency>

</dependencies>
<build>
<plugins>
Expand Down

0 comments on commit c94d782

Please sign in to comment.