forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cloud](storage vault) Rewrite vaults regression test and fix two err…
…or (apache#42411) * Rewrite vaults regression test * Fix show storage vault stmt `default` column incorrectly * Fix create table cannot find storage vault after creating the vault
- Loading branch information
1 parent
fe58d40
commit de93c26
Showing
16 changed files
with
832 additions
and
846 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
regression-test/suites/vault_p0/alter/test_alter_hdfs_vault.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// 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_alter_hdfs_vault", "nonConcurrent") { | ||
def suiteName = name; | ||
if (!isCloudMode()) { | ||
logger.info("skip ${name} case, because not cloud mode") | ||
return | ||
} | ||
|
||
if (!enableStoragevault()) { | ||
logger.info("skip ${name} case, because storage vault not enabled") | ||
return | ||
} | ||
|
||
sql """ | ||
CREATE STORAGE VAULT IF NOT EXISTS ${suiteName} | ||
PROPERTIES ( | ||
"type"="HDFS", | ||
"fs.defaultFS"="${getHmsHdfsFs()}", | ||
"path_prefix" = "${suiteName}", | ||
"hadoop.username" = "hadoop" | ||
); | ||
""" | ||
|
||
expectExceptionLike({ | ||
sql """ | ||
ALTER STORAGE VAULT ${suiteName} | ||
PROPERTIES ( | ||
"type"="hdfs", | ||
"path_prefix" = "${suiteName}" | ||
); | ||
""" | ||
}, "Alter property") | ||
|
||
expectExceptionLike({ | ||
sql """ | ||
ALTER STORAGE VAULT ${suiteName} | ||
PROPERTIES ( | ||
"type"="hdfs", | ||
"fs.defaultFS" = "not_exist_vault" | ||
); | ||
""" | ||
}, "Alter property") | ||
|
||
def vaultName = suiteName | ||
String properties; | ||
|
||
def vaultInfos = try_sql """show storage vault""" | ||
|
||
for (int i = 0; i < vaultInfos.size(); i++) { | ||
def name = vaultInfos[i][0] | ||
if (name.equals(vaultName)) { | ||
properties = vaultInfos[i][2] | ||
} | ||
} | ||
|
||
def newVaultName = suiteName + "_new"; | ||
sql """ | ||
ALTER STORAGE VAULT ${vaultName} | ||
PROPERTIES ( | ||
"type"="hdfs", | ||
"VAULT_NAME" = "${newVaultName}", | ||
"hadoop.username" = "hdfs" | ||
); | ||
""" | ||
|
||
vaultInfos = sql """ SHOW STORAGE VAULT; """ | ||
boolean exist = false | ||
|
||
for (int i = 0; i < vaultInfos.size(); i++) { | ||
def name = vaultInfos[i][0] | ||
logger.info("name is ${name}, info ${vaultInfos[i]}") | ||
if (name.equals(vaultName)) { | ||
assertTrue(false); | ||
} | ||
if (name.equals(newVaultName)) { | ||
assertTrue(vaultInfos[i][2].contains("""user: "hdfs" """)) | ||
exist = true | ||
} | ||
} | ||
assertTrue(exist) | ||
expectExceptionLike({sql """insert into ${suiteName} values("2", "2");"""}, "") | ||
} |
106 changes: 106 additions & 0 deletions
106
regression-test/suites/vault_p0/alter/test_alter_s3_vault.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// 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_alter_s3_vault", "nonConcurrent") { | ||
def suiteName = name; | ||
if (!isCloudMode()) { | ||
logger.info("skip ${suiteName} case, because not cloud mode") | ||
return | ||
} | ||
|
||
if (!enableStoragevault()) { | ||
logger.info("skip ${suiteName} case, because storage vault not enabled") | ||
return | ||
} | ||
|
||
sql """ | ||
CREATE STORAGE VAULT IF NOT EXISTS ${suiteName} | ||
PROPERTIES ( | ||
"type"="S3", | ||
"s3.endpoint"="${getS3Endpoint()}", | ||
"s3.region" = "${getS3Region()}", | ||
"s3.access_key" = "${getS3AK()}", | ||
"s3.secret_key" = "${getS3SK()}", | ||
"s3.root.path" = "${suiteName}", | ||
"s3.bucket" = "${getS3BucketName()}", | ||
"s3.external_endpoint" = "", | ||
"provider" = "${getS3Provider()}" | ||
); | ||
""" | ||
|
||
expectExceptionLike({ | ||
sql """ | ||
ALTER STORAGE VAULT ${suiteName} | ||
PROPERTIES ( | ||
"type"="S3", | ||
"s3.bucket" = "error_bucket" | ||
); | ||
""" | ||
}, "Alter property") | ||
|
||
expectExceptionLike({ | ||
sql """ | ||
ALTER STORAGE VAULT ${suiteName} | ||
PROPERTIES ( | ||
"type"="S3", | ||
"provider" = "${getS3Provider()}" | ||
); | ||
""" | ||
}, "Alter property") | ||
|
||
|
||
def vaultName = suiteName | ||
String properties; | ||
|
||
def vaultInfos = try_sql """show storage vault""" | ||
|
||
for (int i = 0; i < vaultInfos.size(); i++) { | ||
def name = vaultInfos[i][0] | ||
if (name.equals(vaultName)) { | ||
properties = vaultInfos[i][2] | ||
} | ||
} | ||
|
||
def newVaultName = suiteName + "_new"; | ||
|
||
sql """ | ||
ALTER STORAGE VAULT ${vaultName} | ||
PROPERTIES ( | ||
"type"="S3", | ||
"VAULT_NAME" = "${newVaultName}", | ||
"s3.access_key" = "new_ak" | ||
); | ||
""" | ||
|
||
vaultInfos = sql """SHOW STORAGE VAULT;""" | ||
boolean exist = false | ||
|
||
for (int i = 0; i < vaultInfos.size(); i++) { | ||
def name = vaultInfos[i][0] | ||
logger.info("name is ${name}, info ${vaultInfos[i]}") | ||
if (name.equals(vaultName)) { | ||
assertTrue(false); | ||
} | ||
if (name.equals(newVaultName)) { | ||
assertTrue(vaultInfos[i][2].contains("new_ak")) | ||
exist = true | ||
} | ||
} | ||
assertTrue(exist) | ||
// failed to insert due to the wrong ak | ||
expectExceptionLike({ sql """insert into alter_s3_vault_tbl values("2", "2");""" }, "") | ||
} |
Oops, something went wrong.