This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 e0910da4f41 Add smoke property to IntegrationTestCase. (#31835)
e0910da4f41 is described below
commit e0910da4f41d221cc8d023bc33da51fe519431cb
Author: Cong Hu <[email protected]>
AuthorDate: Tue Jun 25 11:38:26 2024 +0800
Add smoke property to IntegrationTestCase. (#31835)
---
.../test/e2e/env/runtime/IntegrationTestEnvironment.java | 3 +++
.../test/e2e/cases/assertion/IntegrationTestCase.java | 3 +++
.../param/array/ClusterTestParameterArrayGenerator.java | 4 ++--
.../framework/param/array/E2ETestParameterGenerator.java | 16 +++++++++++++++-
.../array/JdbcStandaloneTestParameterGenerator.java | 6 ++++--
.../array/ProxyStandaloneTestParameterGenerator.java | 4 ++--
.../test/resources/cases/dql/dql-integration-select.xml | 4 ++--
test/e2e/sql/src/test/resources/env/it-env.properties | 1 +
8 files changed, 32 insertions(+), 9 deletions(-)
diff --git
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/IntegrationTestEnvironment.java
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/IntegrationTestEnvironment.java
index 755a9d656f3..e126fdb2a74 100644
---
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/IntegrationTestEnvironment.java
+++
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/IntegrationTestEnvironment.java
@@ -44,12 +44,15 @@ public final class IntegrationTestEnvironment {
private final ClusterEnvironment clusterEnvironment;
+ private final boolean smoke;
+
private IntegrationTestEnvironment() {
Properties props = loadProperties();
runModes =
Splitter.on(",").trimResults().splitToList(props.getProperty("it.run.modes"));
runAdditionalTestCases =
Boolean.parseBoolean(props.getProperty("it.run.additional.cases"));
TimeZone.setDefault(TimeZone.getTimeZone(props.getProperty("it.timezone",
"UTC")));
scenarios = getScenarios(props);
+ smoke = Boolean.parseBoolean(props.getProperty("it.run.smoke"));
clusterEnvironment = new ClusterEnvironment(props);
}
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/assertion/IntegrationTestCase.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/assertion/IntegrationTestCase.java
index 62e0365d2da..cf32ed79646 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/assertion/IntegrationTestCase.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/assertion/IntegrationTestCase.java
@@ -53,6 +53,9 @@ public final class IntegrationTestCase {
@XmlAttribute(name = "delay-assertion-seconds")
private Integer delayAssertionSeconds;
+ @XmlAttribute(name = "smoke")
+ private boolean smoke;
+
@XmlElement(name = "assertion")
private Collection<IntegrationTestCaseAssertion> assertions = new
LinkedList<>();
}
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/ClusterTestParameterArrayGenerator.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/ClusterTestParameterArrayGenerator.java
index 222c7dfc1d0..70f57c903d1 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/ClusterTestParameterArrayGenerator.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/ClusterTestParameterArrayGenerator.java
@@ -43,7 +43,7 @@ public final class ClusterTestParameterArrayGenerator {
*/
public static Collection<AssertionTestParameter>
getAssertionTestParameter(final SQLCommandType sqlCommandType) {
return new
E2ETestParameterGenerator(ENV.getClusterEnvironment().getAdapters(),
ENV.getScenarios(), AdapterMode.CLUSTER.getValue(),
-
ENV.getClusterEnvironment().getDatabaseTypes()).getAssertionTestParameter(sqlCommandType);
+ ENV.getClusterEnvironment().getDatabaseTypes(),
ENV.isSmoke()).getAssertionTestParameter(sqlCommandType);
}
/**
@@ -54,6 +54,6 @@ public final class ClusterTestParameterArrayGenerator {
*/
public static Collection<E2ETestParameter> getCaseTestParameter(final
SQLCommandType sqlCommandType) {
return new
E2ETestParameterGenerator(ENV.getClusterEnvironment().getAdapters(),
ENV.getScenarios(), AdapterMode.CLUSTER.getValue(),
-
ENV.getClusterEnvironment().getDatabaseTypes()).getCaseTestParameter(sqlCommandType);
+ ENV.getClusterEnvironment().getDatabaseTypes(),
ENV.isSmoke()).getCaseTestParameter(sqlCommandType);
}
}
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/E2ETestParameterGenerator.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/E2ETestParameterGenerator.java
index cd06d0312cc..d6aef4a3342 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/E2ETestParameterGenerator.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/E2ETestParameterGenerator.java
@@ -56,6 +56,8 @@ public final class E2ETestParameterGenerator {
private final Collection<DatabaseType> envDatabaseTypes;
+ private final boolean smoke;
+
/**
* Get assertion test parameter.
*
@@ -65,7 +67,11 @@ public final class E2ETestParameterGenerator {
public Collection<AssertionTestParameter> getAssertionTestParameter(final
SQLCommandType sqlCommandType) {
Collection<AssertionTestParameter> result = new LinkedList<>();
for (IntegrationTestCaseContext each :
TEST_CASES_LOADER.getTestCaseContexts(sqlCommandType)) {
- result.addAll(getAssertionTestParameter(each, sqlCommandType));
+ if (smoke) {
+ result.addAll(getAssertionTestParameterFilterBySmoke(each,
sqlCommandType));
+ } else {
+ result.addAll(getAssertionTestParameter(each, sqlCommandType));
+ }
}
return result;
}
@@ -120,6 +126,14 @@ public final class E2ETestParameterGenerator {
.map(each -> new AssertionTestParameter(testCaseContext,
assertion, adapter, each, envMode, databaseType, sqlExecuteType,
sqlCommandType)).collect(Collectors.toList());
}
+ private Collection<AssertionTestParameter>
getAssertionTestParameterFilterBySmoke(final IntegrationTestCaseContext
testCaseContext, final SQLCommandType sqlCommandType) {
+ Collection<AssertionTestParameter> result = new LinkedList<>();
+ if (testCaseContext.getTestCase().isSmoke()) {
+ result.addAll(getAssertionTestParameter(testCaseContext,
sqlCommandType));
+ }
+ return result;
+ }
+
private Collection<String> getEnvAdapters(final String envAdapters) {
return Strings.isNullOrEmpty(envAdapters) ? this.envAdapters :
Splitter.on(',').trimResults().splitToList(envAdapters);
}
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/JdbcStandaloneTestParameterGenerator.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/JdbcStandaloneTestParameterGenerator.java
index 7340056f88b..11b74690938 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/JdbcStandaloneTestParameterGenerator.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/JdbcStandaloneTestParameterGenerator.java
@@ -46,7 +46,8 @@ public final class JdbcStandaloneTestParameterGenerator {
* @return assertion test parameter
*/
public static Collection<AssertionTestParameter>
getAssertionTestParameter(final SQLCommandType sqlCommandType) {
- return new E2ETestParameterGenerator(ADAPTERS, ENV.getScenarios(),
AdapterMode.STANDALONE.getValue(),
ENV.getClusterEnvironment().getDatabaseTypes()).getAssertionTestParameter(sqlCommandType);
+ return new E2ETestParameterGenerator(ADAPTERS, ENV.getScenarios(),
AdapterMode.STANDALONE.getValue(),
ENV.getClusterEnvironment().getDatabaseTypes(), ENV.isSmoke())
+ .getAssertionTestParameter(sqlCommandType);
}
/**
@@ -56,6 +57,7 @@ public final class JdbcStandaloneTestParameterGenerator {
* @return case test parameter
*/
public static Collection<E2ETestParameter> getCaseTestParameter(final
SQLCommandType sqlCommandType) {
- return new E2ETestParameterGenerator(ADAPTERS, ENV.getScenarios(),
AdapterMode.STANDALONE.getValue(),
ENV.getClusterEnvironment().getDatabaseTypes()).getCaseTestParameter(sqlCommandType);
+ return new E2ETestParameterGenerator(ADAPTERS, ENV.getScenarios(),
AdapterMode.STANDALONE.getValue(),
ENV.getClusterEnvironment().getDatabaseTypes(), ENV.isSmoke())
+ .getCaseTestParameter(sqlCommandType);
}
}
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/ProxyStandaloneTestParameterGenerator.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/ProxyStandaloneTestParameterGenerator.java
index a2424b29b38..f88d9e2a563 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/ProxyStandaloneTestParameterGenerator.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/framework/param/array/ProxyStandaloneTestParameterGenerator.java
@@ -43,7 +43,7 @@ public final class ProxyStandaloneTestParameterGenerator {
*/
public static Collection<AssertionTestParameter>
getAssertionTestParameter(final SQLCommandType sqlCommandType) {
return new
E2ETestParameterGenerator(ENV.getClusterEnvironment().getAdapters(),
- ENV.getScenarios(), AdapterMode.STANDALONE.getValue(),
ENV.getClusterEnvironment().getDatabaseTypes()).getAssertionTestParameter(sqlCommandType);
+ ENV.getScenarios(), AdapterMode.STANDALONE.getValue(),
ENV.getClusterEnvironment().getDatabaseTypes(),
ENV.isSmoke()).getAssertionTestParameter(sqlCommandType);
}
/**
@@ -54,6 +54,6 @@ public final class ProxyStandaloneTestParameterGenerator {
*/
public static Collection<E2ETestParameter> getCaseTestParameter(final
SQLCommandType sqlCommandType) {
return new
E2ETestParameterGenerator(ENV.getClusterEnvironment().getAdapters(),
- ENV.getScenarios(), AdapterMode.STANDALONE.getValue(),
ENV.getClusterEnvironment().getDatabaseTypes()).getCaseTestParameter(sqlCommandType);
+ ENV.getScenarios(), AdapterMode.STANDALONE.getValue(),
ENV.getClusterEnvironment().getDatabaseTypes(),
ENV.isSmoke()).getCaseTestParameter(sqlCommandType);
}
}
diff --git
a/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select.xml
b/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select.xml
index 048be366fc7..63c801ea354 100644
--- a/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select.xml
+++ b/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select.xml
@@ -17,11 +17,11 @@
-->
<integration-test-cases>
- <test-case sql="SELECT 1 FROM dual" db-types="MySQL,SQLServer,Oracle,H2"
scenario-types="db,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,empty_rules,encrypt,encrypt_and_readwrite_splitting,encrypt_shadow,mask,mask_encrypt,mask_encrypt_sharding,mask_sharding,passthrough,rdl_empty_rules,readwrite_splitting,readwrite_splitting_and_shadow,shadow,sharding_and_encrypt,sharding_and_shadow,sharding_encrypt_shadow,tbl"
>
+ <test-case sql="SELECT 1 FROM dual" db-types="MySQL,SQLServer,Oracle,H2"
smoke="true"
scenario-types="db,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,empty_rules,encrypt,encrypt_and_readwrite_splitting,encrypt_shadow,mask,mask_encrypt,mask_encrypt_sharding,mask_sharding,passthrough,rdl_empty_rules,readwrite_splitting,readwrite_splitting_and_shadow,shadow,sharding_and_encrypt,sharding_and_shadow,sharding_encrypt_shadow,tbl"
>
<assertion />
</test-case>
- <test-case sql="SELECT 1 as a" db-types="PostgreSQL,openGauss"
scenario-types="db,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,empty_rules,encrypt,encrypt_and_readwrite_splitting,encrypt_shadow,mask,mask_encrypt,mask_encrypt_sharding,mask_sharding,passthrough,rdl_empty_rules,readwrite_splitting,readwrite_splitting_and_shadow,shadow,sharding_and_encrypt,sharding_and_shadow,sharding_encrypt_shadow,tbl"
>
+ <test-case sql="SELECT 1 as a" db-types="PostgreSQL,openGauss"
smoke="true"
scenario-types="db,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,empty_rules,encrypt,encrypt_and_readwrite_splitting,encrypt_shadow,mask,mask_encrypt,mask_encrypt_sharding,mask_sharding,passthrough,rdl_empty_rules,readwrite_splitting,readwrite_splitting_and_shadow,shadow,sharding_and_encrypt,sharding_and_shadow,sharding_encrypt_shadow,tbl"
>
<assertion />
</test-case>
diff --git a/test/e2e/sql/src/test/resources/env/it-env.properties
b/test/e2e/sql/src/test/resources/env/it-env.properties
index 97e7b7f8a05..5204d8ce89e 100644
--- a/test/e2e/sql/src/test/resources/env/it-env.properties
+++ b/test/e2e/sql/src/test/resources/env/it-env.properties
@@ -18,6 +18,7 @@
#it.run.modes=Standalone,Cluster
it.run.modes=
it.run.additional.cases=false
+it.run.smoke=false
#it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,rdl_empty_rules,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow,sharding_encrypt_shadow,mask,mask_encrypt,mask_sharding,mask_encrypt_sharding,db_tbl_sql_federation
it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,rdl_empty_rules,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow,sharding_encrypt_shadow,mask,mask_encrypt,mask_sharding,mask_encrypt_sharding,db_tbl_sql_federation