forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
branch-2.1: [fix](auth)Fix after fe restarting, external permissions …
…are lost (apache#43307) Cherry-picked from apache#43275 Co-authored-by: zhangdong <[email protected]>
- Loading branch information
1 parent
876fae6
commit 8fedb03
Showing
3 changed files
with
80 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// 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_up_down_hive_prepare_auth","p0,auth,restart_fe,external,hive,external_docker,external_docker_hive") { | ||
String enabled = context.config.otherConfigs.get("enableHiveTest") | ||
if (enabled == null || !enabled.equalsIgnoreCase("true")) { | ||
logger.info("diable Hive test.") | ||
return; | ||
} | ||
String suiteName = "auth_up_down_hive" | ||
String hivePrefix = "hive2"; | ||
String hms_port = context.config.otherConfigs.get(hivePrefix + "HmsPort") | ||
String externalEnvIp = context.config.otherConfigs.get("externalEnvIp") | ||
String catalogName = "${hivePrefix}_${suiteName}_catalog" | ||
String userName = "${hivePrefix}_${suiteName}_user" | ||
String pwd = 'C123_567p' | ||
|
||
try_sql("DROP USER ${userName}") | ||
sql """CREATE USER '${userName}' IDENTIFIED BY '${pwd}'""" | ||
|
||
sql """drop catalog if exists ${catalogName}""" | ||
sql """create catalog if not exists ${catalogName} properties ( | ||
"type"="hms", | ||
'hive.metastore.uris' = 'thrift://${externalEnvIp}:${hms_port}' | ||
);""" | ||
sql """grant select_priv on ${catalogName}.tpch1_parquet.customer to ${userName}""" | ||
|
||
def res = sql """show grants for ${userName}""" | ||
logger.info("res: " + res.toString()) | ||
assertTrue(res.toString().contains("${catalogName}.tpch1_parquet.customer")) | ||
} |
32 changes: 32 additions & 0 deletions
32
regression-test/suites/auth_up_down_hive_p0/test_up_down_hive_auth.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,32 @@ | ||
// 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_up_down_hive_auth","p0,mtmv,restart_fe,external,hive,external_docker,external_docker_hive") { | ||
String enabled = context.config.otherConfigs.get("enableHiveTest") | ||
if (enabled == null || !enabled.equalsIgnoreCase("true")) { | ||
logger.info("diable Hive test.") | ||
return; | ||
} | ||
String suiteName = "auth_up_down_hive" | ||
String hivePrefix = "hive2"; | ||
String catalogName = "${hivePrefix}_${suiteName}_catalog" | ||
String userName = "${hivePrefix}_${suiteName}_user" | ||
|
||
def res = sql """show grants for ${userName}""" | ||
logger.info("res: " + res.toString()) | ||
assertTrue(res.toString().contains("${catalogName}.tpch1_parquet.customer")) | ||
} |