mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-04 13:26:30 +00:00
source-connection-unitest-added (#4916)
This commit is contained in:
parent
364f185e63
commit
da92d07c78
@ -278,11 +278,8 @@ def _(connection: HiveConnection):
|
|||||||
url += f"{connection.username}"
|
url += f"{connection.username}"
|
||||||
if not connection.password:
|
if not connection.password:
|
||||||
connection.password = SecretStr("")
|
connection.password = SecretStr("")
|
||||||
url += (
|
url += f":{quote_plus(connection.password.get_secret_value())}"
|
||||||
f":{quote_plus(connection.password.get_secret_value())}"
|
|
||||||
if connection
|
|
||||||
else ""
|
|
||||||
)
|
|
||||||
url += "@"
|
url += "@"
|
||||||
|
|
||||||
url += connection.hostPort
|
url += connection.hostPort
|
||||||
|
@ -97,20 +97,48 @@ class SouceConnectionTest(TestCase):
|
|||||||
|
|
||||||
def test_hive_url(self):
|
def test_hive_url(self):
|
||||||
expected_result = "hive://localhost:10000/default"
|
expected_result = "hive://localhost:10000/default"
|
||||||
databricks_conn_obj = HiveConnection(
|
hive_conn_obj = HiveConnection(
|
||||||
scheme=HiveScheme.hive, hostPort="localhost:10000", database="default"
|
scheme=HiveScheme.hive, hostPort="localhost:10000", database="default"
|
||||||
)
|
)
|
||||||
assert expected_result == get_connection_url(databricks_conn_obj)
|
assert expected_result == get_connection_url(hive_conn_obj)
|
||||||
|
|
||||||
def test_hive_url_auth(self):
|
def test_hive_url_custom_auth(self):
|
||||||
expected_result = "hive://localhost:10000/default;auth=CUSTOM"
|
expected_result = "hive://username:password@localhost:10000/default"
|
||||||
databricks_conn_obj = HiveConnection(
|
hive_conn_obj = HiveConnection(
|
||||||
scheme=HiveScheme.hive,
|
scheme=HiveScheme.hive.value,
|
||||||
|
username="username",
|
||||||
|
password="password",
|
||||||
hostPort="localhost:10000",
|
hostPort="localhost:10000",
|
||||||
database="default",
|
database="default",
|
||||||
authOptions="auth=CUSTOM",
|
connectionArguments={"auth": "CUSTOM"},
|
||||||
)
|
)
|
||||||
assert expected_result == get_connection_url(databricks_conn_obj)
|
assert expected_result == get_connection_url(hive_conn_obj)
|
||||||
|
|
||||||
|
def test_hive_url_with_kerberos_auth(self):
|
||||||
|
expected_result = "hive://localhost:10000/default"
|
||||||
|
hive_conn_obj = HiveConnection(
|
||||||
|
scheme=HiveScheme.hive.value,
|
||||||
|
hostPort="localhost:10000",
|
||||||
|
database="default",
|
||||||
|
connectionArguments={
|
||||||
|
"auth": "KERBEROS",
|
||||||
|
"kerberos_service_name": "hive",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
assert expected_result == get_connection_url(hive_conn_obj)
|
||||||
|
|
||||||
|
def test_hive_url_with_ldap_auth(self):
|
||||||
|
expected_result = "hive://username:password@localhost:10000/default"
|
||||||
|
hive_conn_obj = HiveConnection(
|
||||||
|
scheme=HiveScheme.hive.value,
|
||||||
|
username="username",
|
||||||
|
password="password",
|
||||||
|
hostPort="localhost:10000",
|
||||||
|
database="default",
|
||||||
|
connectionArguments={"auth": "LDAP"},
|
||||||
|
)
|
||||||
|
assert expected_result == get_connection_url(hive_conn_obj)
|
||||||
|
|
||||||
def test_trino_url_without_params(self):
|
def test_trino_url_without_params(self):
|
||||||
expected_url = "trino://username:pass@localhost:443/catalog"
|
expected_url = "trino://username:pass@localhost:443/catalog"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user