2022-05-26 15:29:21 -07:00
|
|
|
import platform
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
2022-05-26 12:42:50 +02:00
|
|
|
from datahub.ingestion.api.common import PipelineContext
|
|
|
|
from datahub.ingestion.source.sql.hana import HanaConfig, HanaSource
|
|
|
|
|
|
|
|
|
2022-05-26 15:29:21 -07:00
|
|
|
@pytest.mark.skipif(
|
|
|
|
platform.machine().lower() == "aarch64",
|
|
|
|
reason="The hdbcli dependency is not available for aarch64",
|
|
|
|
)
|
2022-05-26 12:42:50 +02:00
|
|
|
def test_platform_correctly_set_hana():
|
|
|
|
source = HanaSource(
|
|
|
|
ctx=PipelineContext(run_id="hana-source-test"),
|
|
|
|
config=HanaConfig(),
|
|
|
|
)
|
|
|
|
assert source.platform == "hana"
|
|
|
|
|
|
|
|
|
2022-05-26 15:29:21 -07:00
|
|
|
@pytest.mark.skipif(
|
|
|
|
platform.machine().lower() == "aarch64",
|
|
|
|
reason="The hdbcli dependency is not available for aarch64",
|
|
|
|
)
|
2022-05-26 12:42:50 +02:00
|
|
|
def test_hana_uri_native():
|
|
|
|
config = HanaConfig.parse_obj(
|
|
|
|
{
|
|
|
|
"username": "user",
|
|
|
|
"password": "password",
|
|
|
|
"host_port": "host:39041",
|
|
|
|
"scheme": "hana+hdbcli",
|
|
|
|
}
|
|
|
|
)
|
|
|
|
assert config.get_sql_alchemy_url() == "hana+hdbcli://user:password@host:39041"
|
|
|
|
|
|
|
|
|
2022-05-26 15:29:21 -07:00
|
|
|
@pytest.mark.skipif(
|
|
|
|
platform.machine().lower() == "aarch64",
|
|
|
|
reason="The hdbcli dependency is not available for aarch64",
|
|
|
|
)
|
2022-05-26 12:42:50 +02:00
|
|
|
def test_hana_uri_native_db():
|
|
|
|
config = HanaConfig.parse_obj(
|
|
|
|
{
|
|
|
|
"username": "user",
|
|
|
|
"password": "password",
|
|
|
|
"host_port": "host:39041",
|
|
|
|
"scheme": "hana+hdbcli",
|
|
|
|
"database": "database",
|
|
|
|
}
|
|
|
|
)
|
|
|
|
assert (
|
|
|
|
config.get_sql_alchemy_url()
|
|
|
|
== "hana+hdbcli://user:password@host:39041/database"
|
|
|
|
)
|