-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[test](vault) Add more regression test about storage vault
* Add case sensitive test * Add kerberos test * Add concurrent test
- Loading branch information
1 parent
34ef39e
commit 79a123f
Showing
13 changed files
with
1,045 additions
and
8 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
128 changes: 128 additions & 0 deletions
128
regression-test/suites/vault_p0/concurent/test_alter_vault_concurrently.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,128 @@ | ||
// 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; | ||
import java.util.stream.Stream; | ||
|
||
suite("test_alter_vault_concurrently", "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 | ||
} | ||
|
||
def randomStr = UUID.randomUUID().toString().replace("-", "") | ||
def s3VaultName = "s3_" + randomStr | ||
|
||
sql """ | ||
CREATE STORAGE VAULT ${s3VaultName} | ||
PROPERTIES ( | ||
"type"="S3", | ||
"s3.endpoint"="${getS3Endpoint()}", | ||
"s3.region" = "${getS3Region()}", | ||
"s3.access_key" = "${getS3AK()}", | ||
"s3.secret_key" = "${getS3SK()}", | ||
"s3.root.path" = "${s3VaultName}", | ||
"s3.bucket" = "${getS3BucketName()}", | ||
"s3.external_endpoint" = "", | ||
"provider" = "${getS3Provider()}", | ||
"use_path_style" = "false" | ||
); | ||
""" | ||
|
||
def future1 = thread("threadName1") { | ||
try_sql """ | ||
ALTER STORAGE VAULT ${s3VaultName} | ||
PROPERTIES ( | ||
"type"="S3", | ||
"VAULT_NAME" = "${s3VaultName}_1" | ||
); | ||
""" | ||
} | ||
|
||
def future2 = thread("threadName2") { | ||
try_sql """ | ||
ALTER STORAGE VAULT ${s3VaultName} | ||
PROPERTIES ( | ||
"type"="S3", | ||
"VAULT_NAME" = "${s3VaultName}_2" | ||
); | ||
""" | ||
} | ||
|
||
def combineFuture = combineFutures(future1, future2) | ||
List<List<List<Object>>> result = combineFuture.get() | ||
logger.info("${result}") | ||
|
||
def hitNum = 0 | ||
def vaultsInfo = try_sql """ SHOW STORAGE VAULTS """ | ||
def newS3VaultName = null | ||
|
||
for (int i = 0; i < vaultsInfo.size(); i++) { | ||
def name = vaultsInfo[i][0] | ||
if (name.contains(s3VaultName)) { | ||
hitNum++ | ||
newS3VaultName = name | ||
assertTrue(name.equalsIgnoreCase("${s3VaultName}_1") || name.equalsIgnoreCase("${s3VaultName}_2")) | ||
} | ||
} | ||
assertEquals(hitNum, 1) | ||
|
||
future1 = thread("threadName1") { | ||
try_sql """ | ||
ALTER STORAGE VAULT ${newS3VaultName} | ||
PROPERTIES ( | ||
"type"="S3", | ||
"VAULT_NAME" = "${s3VaultName}_1" | ||
"s3.access_key" = "error_ak_1", | ||
"s3.secret_key" = "error_sk_1" | ||
); | ||
""" | ||
} | ||
|
||
future2 = thread("threadName2") { | ||
try_sql """ | ||
ALTER STORAGE VAULT ${newS3VaultName} | ||
PROPERTIES ( | ||
"type"="S3", | ||
"s3.access_key" = "error_ak_2", | ||
"s3.secret_key" = "error_sk_2" | ||
); | ||
""" | ||
} | ||
|
||
combineFuture = combineFutures(future1, future2) | ||
result = combineFuture.get() | ||
logger.info("${result}") | ||
|
||
vaultsInfo = try_sql """ SHOW STORAGE VAULTS """ | ||
def found = false | ||
for (int i = 0; i < vaultsInfo.size(); i++) { | ||
def name = vaultsInfo[i][0] | ||
if (name.contains(newS3VaultName)) { | ||
logger.info("${vaultsInfo[i]}"); | ||
assertTrue(vaultsInfo[i][2].contains("error_ak_1") || vaultsInfo[i][2].contains("error_ak_2")) | ||
found = true | ||
} | ||
} | ||
assertTrue(found) | ||
} |
132 changes: 132 additions & 0 deletions
132
regression-test/suites/vault_p0/concurent/test_create_vault_concurrently.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,132 @@ | ||
// 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; | ||
import java.util.stream.Stream; | ||
|
||
suite("test_create_vault_concurrently", "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 | ||
} | ||
|
||
def randomStr = UUID.randomUUID().toString().replace("-", "") | ||
def s3VaultName = "s3_" + randomStr | ||
|
||
def future1 = thread("threadName1") { | ||
for (int i = 0; i < 100; i++) { | ||
sql """ | ||
CREATE STORAGE VAULT IF NOT EXISTS ${s3VaultName} | ||
PROPERTIES ( | ||
"type"="S3", | ||
"s3.endpoint"="${getS3Endpoint()}", | ||
"s3.region" = "${getS3Region()}", | ||
"s3.access_key" = "${getS3AK()}", | ||
"s3.secret_key" = "${getS3SK()}", | ||
"s3.root.path" = "${s3VaultName}", | ||
"s3.bucket" = "${getS3BucketName()}", | ||
"s3.external_endpoint" = "", | ||
"provider" = "${getS3Provider()}", | ||
"use_path_style" = "false" | ||
); | ||
""" | ||
} | ||
} | ||
|
||
def future2 = thread("threadName2") { | ||
for (int i = 0; i < 100; i++) { | ||
sql """ | ||
CREATE STORAGE VAULT IF NOT EXISTS ${s3VaultName} | ||
PROPERTIES ( | ||
"type"="S3", | ||
"s3.endpoint"="${getS3Endpoint()}", | ||
"s3.region" = "${getS3Region()}", | ||
"s3.access_key" = "${getS3AK()}", | ||
"s3.secret_key" = "${getS3SK()}", | ||
"s3.root.path" = "${s3VaultName}", | ||
"s3.bucket" = "${getS3BucketName()}", | ||
"s3.external_endpoint" = "", | ||
"provider" = "${getS3Provider()}", | ||
"use_path_style" = "false" | ||
); | ||
""" | ||
} | ||
} | ||
|
||
def future3 = thread("threadName3") { | ||
for (int i = 0; i < 100; i++) { | ||
sql """ | ||
CREATE STORAGE VAULT IF NOT EXISTS ${s3VaultName} | ||
PROPERTIES ( | ||
"type"="S3", | ||
"s3.endpoint"="${getS3Endpoint()}", | ||
"s3.region" = "${getS3Region()}", | ||
"s3.access_key" = "${getS3AK()}", | ||
"s3.secret_key" = "${getS3SK()}", | ||
"s3.root.path" = "${s3VaultName}", | ||
"s3.bucket" = "${getS3BucketName()}", | ||
"s3.external_endpoint" = "", | ||
"provider" = "${getS3Provider()}", | ||
"use_path_style" = "false" | ||
); | ||
""" | ||
} | ||
} | ||
|
||
def future4 = thread("threadName4") { | ||
for (int i = 0; i < 100; i++) { | ||
sql """ | ||
CREATE STORAGE VAULT IF NOT EXISTS ${s3VaultName} | ||
PROPERTIES ( | ||
"type"="S3", | ||
"s3.endpoint"="${getS3Endpoint()}", | ||
"s3.region" = "${getS3Region()}", | ||
"s3.access_key" = "${getS3AK()}", | ||
"s3.secret_key" = "${getS3SK()}", | ||
"s3.root.path" = "${s3VaultName}", | ||
"s3.bucket" = "${getS3BucketName()}", | ||
"s3.external_endpoint" = "", | ||
"provider" = "${getS3Provider()}", | ||
"use_path_style" = "false" | ||
); | ||
""" | ||
} | ||
} | ||
|
||
// equals to combineFutures([future1, future2, future3, future4]), which [] is a Iterable<ListenableFuture> | ||
def combineFuture = combineFutures(future1, future2, future3, future4) | ||
// or you can use lazyCheckThread action(see lazyCheck_action.groovy), and not have to check exception from futures. | ||
List<List<List<Object>>> result = combineFuture.get() | ||
logger.info("${result}") | ||
|
||
boolean s3VaultExisted = false; | ||
def vaults_info = try_sql """ SHOW STORAGE VAULTS """ | ||
|
||
for (int i = 0; i < vaults_info.size(); i++) { | ||
def name = vaults_info[i][0] | ||
if (name.equals(s3VaultName)) { | ||
s3VaultExisted = true; | ||
} | ||
} | ||
assertTrue(s3VaultExisted) | ||
} |
Oops, something went wrong.