You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/10/12 02:18:14 UTC

[shardingsphere] branch master updated: add test case for single table rule (#21443)

This is an automated email from the ASF dual-hosted git repository.

zhaojinchao 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 14b800e8725 add test case for single table rule (#21443)
14b800e8725 is described below

commit 14b800e872578b6d49d00acc47bf46c9b089f78f
Author: tianhao960 <ti...@users.noreply.github.com>
AuthorDate: Wed Oct 12 10:18:06 2022 +0800

    add test case for single table rule (#21443)
---
 .../rdl_empty_rules/create_single_table_rules.xml  | 28 ++++++++++++++++++++++
 .../cases/rdl/rdl-integration-test-cases.xml       | 19 +++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/test/integration-test/test-suite/src/test/resources/cases/rdl/dataset/rdl_empty_rules/create_single_table_rules.xml b/test/integration-test/test-suite/src/test/resources/cases/rdl/dataset/rdl_empty_rules/create_single_table_rules.xml
new file mode 100644
index 00000000000..3844292733d
--- /dev/null
+++ b/test/integration-test/test-suite/src/test/resources/cases/rdl/dataset/rdl_empty_rules/create_single_table_rules.xml
@@ -0,0 +1,28 @@
+<!--
+  ~ 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.
+  -->
+
+<dataset>
+    <metadata>
+        <column name="table_name" />
+        <column name="resource_name" />
+    </metadata>
+    <row values="t_user_0| ds_0" />
+    <row values="t_user_4| ds_0" />
+    <row values="t_user_3| ds_0" />
+    <row values="t_user_2| ds_0" />
+    <row values="t_user_1| ds_0" />
+</dataset>
diff --git a/test/integration-test/test-suite/src/test/resources/cases/rdl/rdl-integration-test-cases.xml b/test/integration-test/test-suite/src/test/resources/cases/rdl/rdl-integration-test-cases.xml
index 70d03da84c6..e94d56527c0 100644
--- a/test/integration-test/test-suite/src/test/resources/cases/rdl/rdl-integration-test-cases.xml
+++ b/test/integration-test/test-suite/src/test/resources/cases/rdl/rdl-integration-test-cases.xml
@@ -31,6 +31,25 @@
 <!--            <assertion-sql sql="SHOW DATABASE RESOURCES" />-->
 <!--        </assertion>-->
 <!--    </test-case>-->
+    <test-case sql="CREATE DEFAULT SINGLE TABLE RULE RESOURCE = ds_0;" db-types="MySQL">
+        <assertion expected-data-file="create_single_table_rules.xml">
+            <assertion-sql sql="SHOW SINGLE TABLES;" />
+            <destroy-sql sql="DROP DEFAULT SINGLE TABLE RULE"/>
+        </assertion>
+    </test-case>
+    <test-case sql="ALTER DEFAULT SINGLE TABLE RULE RESOURCE = ds_0;" db-types="MySQL">
+        <assertion expected-data-file="create_single_table_rules.xml">
+            <initial-sql sql="CREATE DEFAULT SINGLE TABLE RULE RESOURCE = ds_1;" />
+            <assertion-sql sql="SHOW SINGLE TABLES;" />
+            <destroy-sql sql="DROP DEFAULT SINGLE TABLE RULE"/>
+        </assertion>
+    </test-case>
+    <test-case sql="DROP DEFAULT SINGLE TABLE RULE" db-types="MySQL">
+        <assertion expected-data-file="create_single_table_rules.xml">
+            <initial-sql sql="CREATE DEFAULT SINGLE TABLE RULE RESOURCE = ds_0;" />
+            <assertion-sql sql="SHOW SINGLE TABLES;" />
+        </assertion>
+    </test-case>
     <test-case sql="CREATE SHARDING TABLE RULE t_user (DATANODES('ds_0.t_user_${0..1}'),TABLE_STRATEGY(TYPE='standard',SHARDING_COLUMN=user_id,SHARDING_ALGORITHM(TYPE(NAME='inline',PROPERTIES('algorithm-expression'='t_user_${user_id % 2}')))))" db-types="MySQL">
         <assertion expected-data-file="create_sharding_rules.xml">
             <assertion-sql sql="SHOW SHARDING TABLE RULES;" />