gavinchou commented on code in PR #45325:
URL: https://github.com/apache/doris/pull/45325#discussion_r1992788592


##########
regression-test/suites/vault_p0/database/test_database_vault.groovy:
##########
@@ -0,0 +1,201 @@
+// 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.
+
+import java.util.stream.Collectors;
+
+suite("test_database_vault", "nonConcurrent") {
+    if (!isCloudMode()) {
+        logger.info("skip test_database_vault case because not cloud mode")
+        return
+    }
+
+    if (!enableStoragevault()) {
+        logger.info("skip test_database_vault case")
+        return
+    }
+
+    def db1 = "test_db_vault_db1"
+    def db2 = "test_db_vault_db2"
+    def vault1 = "test_db_vault_vault1"
+    def vault2 = "test_db_vault_vault2"
+    def table1 = "test_db_vault_table1"
+    def table2 = "test_db_vault_table2"
+
+    try {
+
+        sql """
+            UNSET DEFAULT STORAGE VAULT
+        """
+
+        sql """
+            CREATE STORAGE VAULT IF NOT EXISTS ${vault1}
+            PROPERTIES (
+                "type"="hdfs",
+                "fs.defaultFS"="${getHmsHdfsFs()}",
+                "path_prefix" = "test_db_vault_vault1_prefix"
+            );
+        """
+
+        def storageVaults = (sql " SHOW STORAGE VAULT; ").stream().map(row -> 
row[0]).collect(Collectors.toSet())
+        assertTrue(storageVaults.contains(vault1))
+
+        sql """
+            CREATE STORAGE VAULT IF NOT EXISTS ${vault2}
+            PROPERTIES (
+                "type"="hdfs",
+                "fs.defaultFS"="${getHmsHdfsFs()}",
+                "path_prefix" = "test_db_vault_vault2_prefix"
+            );
+        """
+
+        storageVaults = (sql " SHOW STORAGE VAULT; ").stream().map(row -> 
row[0]).collect(Collectors.toSet())
+        assertTrue(storageVaults.contains(vault2))
+
+        // Create database with vault, vault should exist
+        expectExceptionLike({
+            sql """
+                CREATE DATABASE IF NOT EXISTS ${db1}

Review Comment:
   we should drop the database first before creating



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to