This is an automated email from the ASF dual-hosted git repository.
sunnianjun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new a60484361f8 Make failsafe plugin in the root pom to trigger all test
cases end with suffix IT (#31670)
a60484361f8 is described below
commit a60484361f86d3aca98f5f7219c67131cf0ed9dc
Author: 孙念君 Nianjun Sun <[email protected]>
AuthorDate: Mon Jun 24 23:23:19 2024 +0800
Make failsafe plugin in the root pom to trigger all test cases end with
suffix IT (#31670)
* Add : make tests end with IT as test case in CI (#31634)
* Add : make tests end with Test as test case in CI (#31634)
* Refactor : make the failsafe plugin in the root pom
* Refactor : add log for jinchao to debug
* Refactor : add the new test case from @zhaojinchao95
---
kernel/sql-federation/core/pom.xml | 17 -----------------
kernel/sql-federation/executor/pom.xml | 17 -----------------
kernel/sql-federation/optimizer/pom.xml | 17 -----------------
parser/sql/dialect/pom.xml | 17 -----------------
pom.xml | 17 +++++++++++++++++
test/e2e/agent/pom.xml | 17 -----------------
test/e2e/pom.xml | 17 -----------------
test/it/pom.xml | 17 -----------------
.../it/yaml/RepositoryTupleSwapperEngineIT.java | 21 ++++++++++++++++++---
9 files changed, 35 insertions(+), 122 deletions(-)
diff --git a/kernel/sql-federation/core/pom.xml
b/kernel/sql-federation/core/pom.xml
index fe66410d1fc..d7cc6fd33a7 100644
--- a/kernel/sql-federation/core/pom.xml
+++ b/kernel/sql-federation/core/pom.xml
@@ -62,23 +62,6 @@
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-failsafe-plugin</artifactId>
- <executions>
- <execution>
- <id>integration-tests</id>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
<profiles>
<profile>
<id>jdk8</id>
diff --git a/kernel/sql-federation/executor/pom.xml
b/kernel/sql-federation/executor/pom.xml
index 4a688b41a33..220700186e5 100644
--- a/kernel/sql-federation/executor/pom.xml
+++ b/kernel/sql-federation/executor/pom.xml
@@ -71,23 +71,6 @@
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-failsafe-plugin</artifactId>
- <executions>
- <execution>
- <id>integration-tests</id>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
<profiles>
<profile>
<id>jdk8</id>
diff --git a/kernel/sql-federation/optimizer/pom.xml
b/kernel/sql-federation/optimizer/pom.xml
index aef4051e685..e2ae5cde794 100644
--- a/kernel/sql-federation/optimizer/pom.xml
+++ b/kernel/sql-federation/optimizer/pom.xml
@@ -108,23 +108,6 @@
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-failsafe-plugin</artifactId>
- <executions>
- <execution>
- <id>integration-tests</id>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
<profiles>
<profile>
<id>jdk8</id>
diff --git a/parser/sql/dialect/pom.xml b/parser/sql/dialect/pom.xml
index ee2fd073060..e9cdc4805ec 100644
--- a/parser/sql/dialect/pom.xml
+++ b/parser/sql/dialect/pom.xml
@@ -54,23 +54,6 @@
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-failsafe-plugin</artifactId>
- <executions>
- <execution>
- <id>integration-tests</id>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
<profiles>
<profile>
<id>jdk8</id>
diff --git a/pom.xml b/pom.xml
index 3209d7d6b67..a9b91027dd2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -160,6 +160,7 @@
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
+ <maven-failsafe-plugin.version>3.2.5</maven-failsafe-plugin.version>
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
<jandex-maven-plugin.version>3.1.3</jandex-maven-plugin.version>
<build-helper-maven-plugin.version>3.3.0</build-helper-maven-plugin.version>
@@ -870,6 +871,19 @@
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
+ <plugin>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>${maven-failsafe-plugin.version}</version>
+ <executions>
+ <execution>
+ <id>integration-tests</id>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
@@ -1001,6 +1015,9 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ </plugin>
</plugins>
<extensions>
diff --git a/test/e2e/agent/pom.xml b/test/e2e/agent/pom.xml
index 5696e6dc2ae..5a159609e72 100644
--- a/test/e2e/agent/pom.xml
+++ b/test/e2e/agent/pom.xml
@@ -43,21 +43,4 @@
<artifactId>awaitility</artifactId>
</dependency>
</dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-failsafe-plugin</artifactId>
- <executions>
- <execution>
- <id>integration-tests</id>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
</project>
diff --git a/test/e2e/pom.xml b/test/e2e/pom.xml
index bda2828b3c2..479113d11e6 100644
--- a/test/e2e/pom.xml
+++ b/test/e2e/pom.xml
@@ -39,21 +39,4 @@
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-failsafe-plugin</artifactId>
- <executions>
- <execution>
- <id>integration-tests</id>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
</project>
diff --git a/test/it/pom.xml b/test/it/pom.xml
index 26e1dc2c6a7..eb35bd5b140 100644
--- a/test/it/pom.xml
+++ b/test/it/pom.xml
@@ -34,21 +34,4 @@
<module>rewriter</module>
<module>pipeline</module>
</modules>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-failsafe-plugin</artifactId>
- <executions>
- <execution>
- <id>integration-tests</id>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
</project>
diff --git
a/test/it/yaml/src/main/java/org/apache/shardingsphere/test/it/yaml/RepositoryTupleSwapperEngineIT.java
b/test/it/yaml/src/main/java/org/apache/shardingsphere/test/it/yaml/RepositoryTupleSwapperEngineIT.java
index 7474e62239d..f972587b324 100644
---
a/test/it/yaml/src/main/java/org/apache/shardingsphere/test/it/yaml/RepositoryTupleSwapperEngineIT.java
+++
b/test/it/yaml/src/main/java/org/apache/shardingsphere/test/it/yaml/RepositoryTupleSwapperEngineIT.java
@@ -17,13 +17,14 @@
package org.apache.shardingsphere.test.it.yaml;
+import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
-import org.apache.shardingsphere.mode.tuple.RepositoryTuple;
import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration;
import
org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlGlobalRuleConfiguration;
import
org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration;
-import org.apache.shardingsphere.mode.tuple.annotation.RepositoryTupleEntity;
+import org.apache.shardingsphere.mode.tuple.RepositoryTuple;
import org.apache.shardingsphere.mode.tuple.RepositoryTupleSwapperEngine;
+import org.apache.shardingsphere.mode.tuple.annotation.RepositoryTupleEntity;
import org.junit.jupiter.api.Test;
import java.io.File;
@@ -31,6 +32,7 @@ import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -44,6 +46,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
+@Slf4j
public abstract class RepositoryTupleSwapperEngineIT {
private final File yamlFile;
@@ -82,7 +85,11 @@ public abstract class RepositoryTupleSwapperEngineIT {
@Test
void assertSwapToYamlRuleConfiguration() throws IOException {
- assertThat(getActualYamlContent(), is(getExpectedYamlContent()));
+ String actualYamlContent = getActualYamlContent();
+ String expectedYamlContent = getExpectedYamlContent();
+ if (!sameYamlContext(actualYamlContent, expectedYamlContent)) {
+ assertThat(actualYamlContent, is(expectedYamlContent));
+ }
}
private String getActualYamlContent() throws IOException {
@@ -108,4 +115,12 @@ public abstract class RepositoryTupleSwapperEngineIT {
.filter(each -> !each.contains("#") &&
!each.isEmpty()).collect(Collectors.joining(System.lineSeparator())) +
System.lineSeparator();
return YamlEngine.marshal(YamlEngine.unmarshal(content, Map.class));
}
+
+ private boolean sameYamlContext(final String actualYamlContext, final
String expectedYamlContext) {
+ char[] actualArray = actualYamlContext.toCharArray();
+ char[] expectedArray = expectedYamlContext.toCharArray();
+ Arrays.sort(actualArray);
+ Arrays.sort(expectedArray);
+ return Arrays.equals(actualArray, expectedArray);
+ }
}