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

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git

commit d41da93abe5746d384ac0849be161e9129de8a8c
Author: walter <w41te...@gmail.com>
AuthorDate: Wed Oct 18 22:16:31 2023 +0800

    [cases](regression-test) Add create and drop S3 repository test (#25568)
---
 .../test_create_and_drop_repository.groovy         | 84 ++++++++++++++++++++++
 1 file changed, 84 insertions(+)

diff --git 
a/regression-test/suites/backup_restore/test_create_and_drop_repository.groovy 
b/regression-test/suites/backup_restore/test_create_and_drop_repository.groovy
new file mode 100644
index 00000000000..b291703e733
--- /dev/null
+++ 
b/regression-test/suites/backup_restore/test_create_and_drop_repository.groovy
@@ -0,0 +1,84 @@
+// 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.
+
+suite("test_create_and_drop_repository", "backup_restore") {
+    String repoName = "test_create_and_drop_repository"
+
+    try_sql "DROP REPOSITORY `${repoName}`"
+
+    String ak = getS3AK()
+    String sk = getS3SK()
+    String endpoint = getS3Endpoint()
+    String region = getS3Region()
+    String bucket = context.config.otherConfigs.get("s3BucketName");
+
+    def filter_show_repo_result = { result, name ->
+        for (record in result) {
+            if (record[1] == name)
+                return record
+        }
+        null
+    }
+
+    // case 1. S3 repo
+    sql """
+    CREATE REPOSITORY `${repoName}`
+    WITH S3
+    ON LOCATION "s3://${bucket}/${repoName}"
+    PROPERTIES
+    (
+        "s3.endpoint" = "http://${endpoint}";,
+        "s3.region" = "${region}",
+        "s3.access_key" = "${ak}",
+        "s3.secret_key" = "${sk}"
+    )
+        """
+
+    def result = sql """ SHOW REPOSITORIES """
+    def repo = filter_show_repo_result(result, repoName)
+    assertTrue(repo != null)
+
+    sql "DROP REPOSITORY `${repoName}`"
+
+    result = sql """ SHOW REPOSITORIES """
+    repo = filter_show_repo_result(result, repoName)
+    assertTrue(repo == null)
+
+    // case 2. S3 read only repo
+    sql """
+    CREATE READ ONLY REPOSITORY `${repoName}`
+    WITH S3
+    ON LOCATION "s3://${bucket}/${repoName}"
+    PROPERTIES
+    (
+        "s3.endpoint" = "http://${endpoint}";,
+        "s3.region" = "${region}",
+        "s3.access_key" = "${ak}",
+        "s3.secret_key" = "${sk}"
+    )
+        """
+
+    result = sql """ SHOW REPOSITORIES """
+    repo = filter_show_repo_result(result, repoName)
+    assertTrue(repo != null)
+
+    sql "DROP REPOSITORY `${repoName}`"
+
+    result = sql """ SHOW REPOSITORIES """
+    repo = filter_show_repo_result(result, repoName)
+    assertTrue(repo == null)
+}


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

Reply via email to