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/11/21 11:09:13 UTC

[shardingsphere] branch master updated: Add pg/og \d it. (#22315)

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 c3d1398c60a Add pg/og \d it. (#22315)
c3d1398c60a is described below

commit c3d1398c60a8b21e13f5a9acfab777de7df4ca97
Author: Chuxin Chen <ch...@qq.com>
AuthorDate: Mon Nov 21 19:09:06 2022 +0800

    Add pg/og \d it. (#22315)
---
 .../integration/cases/dataset/DataSetLoader.java   |  6 ++++-
 .../cluster/opengauss/select_sys_data_for_og.xml   | 29 ++++++++++++++++++++++
 .../cluster/postgresql/select_sys_data_for_pg.xml  | 28 +++++++++++++++++++++
 .../opengauss/select_sys_data_for_og.xml           | 26 +++++++++++++++++++
 .../postgresql/select_sys_data_for_pg.xml          | 25 +++++++++++++++++++
 .../cases/ral/ral-integration-test-cases.xml       |  8 ++++++
 .../env/common/cluster/proxy/conf/server.yaml      |  1 +
 7 files changed, 122 insertions(+), 1 deletion(-)

diff --git a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/dataset/DataSetLoader.java b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/dataset/DataSetLoader.java
index d086e61993c..aa0ed26dc99 100644
--- a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/dataset/DataSetLoader.java
+++ b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/dataset/DataSetLoader.java
@@ -55,7 +55,11 @@ public final class DataSetLoader {
     }
     
     private static String getFile(final String parentPath, final String scenario, final DatabaseType databaseType, final String mode, final String dataSetFile) {
-        String result = String.join(File.separator, parentPath, DATA_SET_FOLDER_NAME, scenario, databaseType.getType().toLowerCase(), dataSetFile);
+        String result = String.join(File.separator, parentPath, DATA_SET_FOLDER_NAME, scenario, mode.toLowerCase(), databaseType.getType().toLowerCase(), dataSetFile);
+        if (new File(result).exists()) {
+            return result;
+        }
+        result = String.join(File.separator, parentPath, DATA_SET_FOLDER_NAME, scenario, databaseType.getType().toLowerCase(), dataSetFile);
         if (new File(result).exists()) {
             return result;
         }
diff --git a/test/integration-test/test-suite/src/test/resources/cases/ral/dataset/empty_rules/cluster/opengauss/select_sys_data_for_og.xml b/test/integration-test/test-suite/src/test/resources/cases/ral/dataset/empty_rules/cluster/opengauss/select_sys_data_for_og.xml
new file mode 100644
index 00000000000..e988773805d
--- /dev/null
+++ b/test/integration-test/test-suite/src/test/resources/cases/ral/dataset/empty_rules/cluster/opengauss/select_sys_data_for_og.xml
@@ -0,0 +1,29 @@
+<!--
+  ~ 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="Schema"/>
+        <column name="Name" />
+        <column name="Type" />
+        <column name="Owner" />
+        <column name="Storage" assertion="false" />
+    </metadata>
+    <row values="public | t_single_table | table | mock user |" />
+    <row values="public | t_user | table | mock user |" />
+    <row values="public | t_user_item | table | mock user |" />
+</dataset>
diff --git a/test/integration-test/test-suite/src/test/resources/cases/ral/dataset/empty_rules/cluster/postgresql/select_sys_data_for_pg.xml b/test/integration-test/test-suite/src/test/resources/cases/ral/dataset/empty_rules/cluster/postgresql/select_sys_data_for_pg.xml
new file mode 100644
index 00000000000..79409136e9d
--- /dev/null
+++ b/test/integration-test/test-suite/src/test/resources/cases/ral/dataset/empty_rules/cluster/postgresql/select_sys_data_for_pg.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="Schema"/>
+        <column name="Name" />
+        <column name="Type" />
+        <column name="Owner" />
+    </metadata>
+    <row values="public | t_single_table | table | mock user" />
+    <row values="public | t_user | table | mock user" />
+    <row values="public | t_user_item | table | mock user" />
+</dataset>
diff --git a/test/integration-test/test-suite/src/test/resources/cases/ral/dataset/empty_rules/standalone/opengauss/select_sys_data_for_og.xml b/test/integration-test/test-suite/src/test/resources/cases/ral/dataset/empty_rules/standalone/opengauss/select_sys_data_for_og.xml
new file mode 100644
index 00000000000..63c76c4fa08
--- /dev/null
+++ b/test/integration-test/test-suite/src/test/resources/cases/ral/dataset/empty_rules/standalone/opengauss/select_sys_data_for_og.xml
@@ -0,0 +1,26 @@
+<!--
+  ~ 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="Schema"/>
+        <column name="Name" />
+        <column name="Type" />
+        <column name="Owner" />
+        <column name="Storage" assertion="false" />
+    </metadata>
+</dataset>
diff --git a/test/integration-test/test-suite/src/test/resources/cases/ral/dataset/empty_rules/standalone/postgresql/select_sys_data_for_pg.xml b/test/integration-test/test-suite/src/test/resources/cases/ral/dataset/empty_rules/standalone/postgresql/select_sys_data_for_pg.xml
new file mode 100644
index 00000000000..7335dc5e963
--- /dev/null
+++ b/test/integration-test/test-suite/src/test/resources/cases/ral/dataset/empty_rules/standalone/postgresql/select_sys_data_for_pg.xml
@@ -0,0 +1,25 @@
+<!--
+  ~ 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="Schema"/>
+        <column name="Name" />
+        <column name="Type" />
+        <column name="Owner" />
+    </metadata>
+</dataset>
diff --git a/test/integration-test/test-suite/src/test/resources/cases/ral/ral-integration-test-cases.xml b/test/integration-test/test-suite/src/test/resources/cases/ral/ral-integration-test-cases.xml
index 68b238e7066..4a923e6ca33 100644
--- a/test/integration-test/test-suite/src/test/resources/cases/ral/ral-integration-test-cases.xml
+++ b/test/integration-test/test-suite/src/test/resources/cases/ral/ral-integration-test-cases.xml
@@ -89,5 +89,13 @@
             <assertion-sql sql="SHOW TABLES" />
         </assertion>
     </test-case>
+    
+    <test-case sql="SELECT n.nspname as &quot;Schema&quot;, c.relname as &quot;Name&quot;, CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'm' THEN 'materialized view' WHEN 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' WHEN 'f' THEN 'foreign table' WHEN 'p' THEN 'partitioned table' WHEN 'I' THEN 'partitioned index' END as &quot;Type&quot;, pg_catalog.pg_get_userbyid(c.relowner) as &quot;Owner&quot; FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_name [...]
+        <assertion expected-data-file="select_sys_data_for_pg.xml" />
+    </test-case>
+
+    <test-case sql="SELECT n.nspname as &quot;Schema&quot;, c.relname as &quot;Name&quot;, CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'i' THEN 'index' WHEN 'I' THEN 'global partition index' WHEN 'S' THEN 'sequence' WHEN 'L' THEN 'large sequence' WHEN 'f' THEN 'foreign table' WHEN 'm' THEN 'materialized view'  WHEN 'e' THEN 'stream' WHEN 'o' THEN 'contview' END as &quot;Type&quot;, pg_catalog.pg_get_userbyid(c.relowner) as &quot;Owner&quot;, c.reloptions as &quot;Stora [...]
+        <assertion expected-data-file="select_sys_data_for_og.xml" />
+    </test-case>
 </integration-test-cases>
 
diff --git a/test/integration-test/test-suite/src/test/resources/env/common/cluster/proxy/conf/server.yaml b/test/integration-test/test-suite/src/test/resources/env/common/cluster/proxy/conf/server.yaml
index 2175a2242bb..ef35b20dc1d 100644
--- a/test/integration-test/test-suite/src/test/resources/env/common/cluster/proxy/conf/server.yaml
+++ b/test/integration-test/test-suite/src/test/resources/env/common/cluster/proxy/conf/server.yaml
@@ -41,3 +41,4 @@ props:
   proxy-hint-enabled: true
   sql-show: false
   sql-federation-type: ADVANCED
+  proxy-metadata-collector-enabled: true