diff --git a/cosmos/profiles/trino/base.py b/cosmos/profiles/trino/base.py index a3c242d8f..5554d340e 100644 --- a/cosmos/profiles/trino/base.py +++ b/cosmos/profiles/trino/base.py @@ -41,6 +41,12 @@ def profile(self) -> dict[str, Any]: # remove any null values return self.filter_null(profile_vars) + @property + def mock_profile(self) -> dict[str, Any]: + mock_profile = super().mock_profile + mock_profile["port"] = 99999 + return mock_profile + def transform_host(self, host: str) -> str: """Replaces http:// or https:// with nothing.""" return host.replace("http://", "").replace("https://", "") diff --git a/tests/profiles/trino/test_trino_base.py b/tests/profiles/trino/test_trino_base.py index ee03821e2..19f78c1ef 100644 --- a/tests/profiles/trino/test_trino_base.py +++ b/tests/profiles/trino/test_trino_base.py @@ -84,3 +84,19 @@ def test_profile_args_overrides() -> None: "user": "my_login", "session_properties": {"my_property": "my_value_override"}, } + + +def test_mock_profile() -> None: + """ + Tests that the mock_profile values get set correctly. A non-integer value of port will crash dbt ls. + """ + profile_mapping = TrinoBaseProfileMapping(conn_id="mock_conn_id") + + assert profile_mapping.mock_profile == { + "type": "trino", + "host": "mock_value", + "database": "mock_value", + "schema": "mock_value", + "port": 99999, + "user": "mock_value", + }