Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nativeTest under GraalVM Native Image for all E2E related unit tests #32614

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion .github/workflows/graalvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,34 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
native-image-job-reports: 'true'
- name: Run test with GraalVM Tracing Agent
run: |
./mvnw -B clean install -am -pl test/e2e/operation/transaction -Pit.env.docker -DskipTests
./mvnw -PgenerateMetadata -DskipNativeTests -e clean test native:metadata-copy -Dtransaction.it.env.type=docker -Dtransaction.it.docker.mysql.version=mysql:5.7
- name: Run nativeTest with GraalVM CE for ${{ matrix.java-version }}
run: ./mvnw -PnativeTestInShardingSphere -e clean test
run: |
./mvnw -PnativeTestInShardingSphere -e clean test
- name: Run transaction on mysql:5.7
run: |
./mvnw -B clean install -am -pl test/e2e/operation/transaction -Pit.env.docker -DskipTests
./mvnw -PnativeTestInShardingSphere -e clean test -Dtransaction.it.env.type=docker -Dtransaction.it.docker.mysql.version=mysql:5.7
- name: Run transaction on postgres:12-alpine
run: |
./mvnw -B clean install -am -pl test/e2e/operation/transaction -Pit.env.docker -DskipTests
./mvnw -PnativeTestInShardingSphere -e clean test -Dtransaction.it.env.type=docker -Dtransaction.it.docker.postgresql.version=postgres:12-alpine
- name: Run pipeline on mysql:5.7
run: |
./mvnw -B clean install -am -pl test/e2e/operation/pipeline -Pit.env.docker -DskipTests
./mvnw -PnativeTestInShardingSphere -e clean test -Dpipeline.it.env.type=docker -Dpipeline.it.docker.mysql.version=mysql:5.7
- name: Run pipeline on postgres:12-alpine
run: |
./mvnw -B clean install -am -pl test/e2e/operation/pipeline -Pit.env.docker -DskipTests
./mvnw -PnativeTestInShardingSphere -e clean test -Dpipeline.it.env.type=docker -Dpipeline.it.docker.postgresql.version=postgres:12-alpine
- name: Run pipeline on mariadb:11
run: |
./mvnw -B clean install -am -pl test/e2e/operation/pipeline -Pit.env.docker -DskipTests
./mvnw -PnativeTestInShardingSphere -e clean test -Dpipeline.it.env.type=docker -Dpipeline.it.docker.mariadb.version=mariadb:5.7
- name: Run showprocesslist on mysql:5.7
run: |
./mvnw -B clean install -am -pl test/e2e/operation/showprocesslist -Pit.env.docker -DskipTests
./mvnw -PnativeTestInShardingSphere -e clean test -Dshowprocesslist.it.env.type=docker -Dshowprocesslist.it.docker.mysql.version=mysql:5.7
21 changes: 3 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -970,25 +970,8 @@
</activation>
<properties>
<maven.compiler.release>8</maven.compiler.release>
<argLine>--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/sun.net=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED</argLine>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/sun.net=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED</argLine>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/sun.net=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED</argLine>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Comment on lines +973 to -991
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

java.lang.IllegalAccessError: class com.alibaba.dcm.internal.InetAddressCacheUtilCommons (in unnamed module @0x70b0b186) cannot access class sun.net.InetAddressCachePolicy (in module java.base) because module java.base does not export sun.net to unnamed module @0x70b0b186
	at com.alibaba.dcm.internal.InetAddressCacheUtilCommons.initFieldsOfInetAddressCachePolicy(InetAddressCacheUtilCommons.java:156)
	at com.alibaba.dcm.internal.InetAddressCacheUtilCommons.setCachePolicy0(InetAddressCacheUtilCommons.java:120)
	at com.alibaba.dcm.internal.InetAddressCacheUtilCommons.setDnsCachePolicy(InetAddressCacheUtilCommons.java:70)
	at com.alibaba.dcm.DnsCacheManipulator.setDnsCachePolicy(DnsCacheManipulator.java:311)
	at org.apache.shardingsphere.test.e2e.env.container.atomic.ITContainers.<init>(ITContainers.java:57)
	at org.apache.shardingsphere.test.e2e.transaction.framework.container.compose.BaseContainerComposer.<init>(BaseContainerComposer.java:30)
	at org.apache.shardingsphere.test.e2e.transaction.framework.container.compose.DockerContainerComposer.<init>(DockerContainerComposer.java:58)
	at org.apache.shardingsphere.test.e2e.transaction.engine.base.TransactionContainerComposer.initContainerComposer(TransactionContainerComposer.java:53)
	at org.apache.shardingsphere.test.e2e.transaction.engine.base.TransactionContainerComposer.<init>(TransactionContainerComposer.java:48)
	at org.apache.shardingsphere.test.e2e.transaction.engine.base.TransactionBaseE2EIT.assertTransaction(TransactionBaseE2EIT.java:100)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:212)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:194)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:212)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:212)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:212)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:212)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:212)
	at java.base/java.util.LinkedList$LLSpliterator.forEachRemaining(LinkedList.java:1249)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:556)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:546)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:611)
	at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:291)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:212)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:212)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:212)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1709)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:556)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:546)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:611)
	at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:291)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1709)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:556)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:546)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:611)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
  • This was introduced by Register containers to dns cache. #32491 .
  • I tried to make the JVM arguments of --add-opens java.base/sun.net=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED take effect globally, but it didn't work.
  • @iamhucong , I wonder if there is something somewhere that tries to override argLine?

</profile>
<profile>
<id>generateMetadata</id>
Expand All @@ -1002,6 +985,7 @@
<configuration>
<includes>
<include>org.apache.shardingsphere.test.natived.**</include>
<include>org.apache.shardingsphere.test.e2e.**</include>
</includes>
</configuration>
</plugin>
Expand Down Expand Up @@ -1061,6 +1045,7 @@
<configuration>
<includes>
<include>org.apache.shardingsphere.test.natived.**</include>
<include>org.apache.shardingsphere.test.e2e.**</include>
</includes>
</configuration>
</plugin>
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/operation/pipeline/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>${native-maven-plugin.version}</version>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.shardingsphere.test.e2e.data.pipeline.natived;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledInNativeImage;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

@EnabledInNativeImage
public class SimpleTest {

@Test
void testSimple() {
assertThat(1 + 2, is(3));
}
}
10 changes: 10 additions & 0 deletions test/e2e/operation/showprocesslist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,14 @@
<artifactId>awaitility</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>${native-maven-plugin.version}</version>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.shardingsphere.test.e2e.showprocesslist.natived;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledInNativeImage;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

@EnabledInNativeImage
public class SimpleTest {

@Test
void testSimple() {
assertThat(1 + 2, is(3));
}
}
10 changes: 10 additions & 0 deletions test/e2e/operation/transaction/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,14 @@
<artifactId>awaitility</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>${native-maven-plugin.version}</version>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.shardingsphere.test.e2e.transaction.natived;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledInNativeImage;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

@EnabledInNativeImage
public class SimpleTest {

@Test
void testSimple() {
assertThat(1 + 2, is(3));
}
}
Loading