|
| 1 | +// Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +// or more contributor license agreements. See the NOTICE file |
| 3 | +// distributed with this work for additional information |
| 4 | +// regarding copyright ownership. The ASF licenses this file |
| 5 | +// to you under the Apache License, Version 2.0 (the |
| 6 | +// "License"); you may not use this file except in compliance |
| 7 | +// with the License. You may obtain a copy of the License at |
| 8 | +// |
| 9 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +// |
| 11 | +// Unless required by applicable law or agreed to in writing, |
| 12 | +// software distributed under the License is distributed on an |
| 13 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +// KIND, either express or implied. See the License for the |
| 15 | +// specific language governing permissions and limitations |
| 16 | +// under the License. |
| 17 | + |
| 18 | +suite("test_up_down_hive_prepare_auth","p0,auth,restart_fe,external,hive,external_docker,external_docker_hive") { |
| 19 | + String enabled = context.config.otherConfigs.get("enableHiveTest") |
| 20 | + if (enabled == null || !enabled.equalsIgnoreCase("true")) { |
| 21 | + logger.info("diable Hive test.") |
| 22 | + return; |
| 23 | + } |
| 24 | + String suiteName = "auth_up_down_hive" |
| 25 | + String hivePrefix = "hive2"; |
| 26 | + String hms_port = context.config.otherConfigs.get(hivePrefix + "HmsPort") |
| 27 | + String externalEnvIp = context.config.otherConfigs.get("externalEnvIp") |
| 28 | + String catalogName = "${hivePrefix}_${suiteName}_catalog" |
| 29 | + String userName = "${hivePrefix}_${suiteName}_user" |
| 30 | + String pwd = 'C123_567p' |
| 31 | + |
| 32 | + try_sql("DROP USER ${userName}") |
| 33 | + sql """CREATE USER '${userName}' IDENTIFIED BY '${pwd}'""" |
| 34 | + |
| 35 | + sql """drop catalog if exists ${catalogName}""" |
| 36 | + sql """create catalog if not exists ${catalogName} properties ( |
| 37 | + "type"="hms", |
| 38 | + 'hive.metastore.uris' = 'thrift://${externalEnvIp}:${hms_port}' |
| 39 | + );""" |
| 40 | + sql """grant select_priv on ${catalogName}.tpch1_parquet.customer to ${userName}""" |
| 41 | + |
| 42 | + def res = sql """show grants for ${userName}""" |
| 43 | + logger.info("res: " + res.toString()) |
| 44 | + assertTrue(res.toString().contains("${catalogName}.tpch1_parquet.customer")) |
| 45 | +} |
0 commit comments