Skip to content

Commit

Permalink
Add nativeTest under GraalVM Native Image for all E2E related unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
linghengqian committed Aug 22, 2024
1 parent 2a48c6a commit 1f3ba2f
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 19 deletions.
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>
</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));
}
}

0 comments on commit 1f3ba2f

Please sign in to comment.