Skip to content

Commit

Permalink
add initial functional test for catalog parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleArk committed Dec 17, 2024
1 parent 926d4c5 commit 4a3e5e2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/dbt/cli/requires.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,11 @@ def setup_manifest(ctx: Context, write: bool = True, write_perf_info: bool = Fal
ctx.obj["manifest"] = parse_manifest(
runtime_config, write_perf_info, write, ctx.obj["flags"].write_json
)

adapter = get_adapter(runtime_config)
catalogs = ctx.obj["catalogs"].catalogs if "catalogs" in ctx.obj else []
for catalog in catalogs:
adapter.set_catalog_integration(catalog.name, catalog.active_write_integration)
else:
register_adapter(runtime_config, get_mp_context())
adapter = get_adapter(runtime_config)
Expand Down
36 changes: 36 additions & 0 deletions tests/functional/catalogs/test_catalogs_parsing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from unittest import mock

import pytest

from dbt.tests.util import run_dbt, write_config_file


class TestCatalogsParsing:

@pytest.fixture
def catalogs(self):
return {
"catalogs": [
{
"name": "test_catalog",
"write_integrations": [
{
"name": "write_integration_name",
"external_volume": "write_integration_external_volume",
"table_format": "iceberg",
"catalog_type": "glue",
}
],
}
]
}

def test_catalog_parsing_adapter_initialialization(self, catalogs, project):
write_config_file(catalogs, project.project_root, "catalogs.yml")

mock_set_catalog_integration = mock.Mock()
with mock.patch.object(
type(project.adapter), "set_catalog_integration", mock_set_catalog_integration
):
run_dbt(["run"])
mock_set_catalog_integration.assert_called_once()

0 comments on commit 4a3e5e2

Please sign in to comment.