|
7 | 7 | from unittest import mock
|
8 | 8 | from unittest.mock import patch
|
9 | 9 | import logging
|
| 10 | +from textwrap import dedent |
10 | 11 | import os
|
11 | 12 | import numpy as np # noqa: TID253
|
12 | 13 | import pandas as pd # noqa: TID253
|
@@ -7079,3 +7080,38 @@ def test_scd_type_2_regular_run_with_offset(init_and_plan_context: t.Callable):
|
7079 | 7080 | assert restated_data.iloc[1]["region"] == "ANZ"
|
7080 | 7081 | assert str(restated_data.iloc[1]["valid_from"]) == "2023-01-09 07:26:00"
|
7081 | 7082 | assert pd.isna(restated_data.iloc[1]["valid_to"])
|
| 7083 | + |
| 7084 | + |
| 7085 | +def test_engine_adapters_multi_repo_all_gateways_gathered(copy_to_temp_path): |
| 7086 | + paths = copy_to_temp_path("examples/multi") |
| 7087 | + repo_1_path = paths[0] / "repo_1" |
| 7088 | + repo_2_path = paths[0] / "repo_2" |
| 7089 | + |
| 7090 | + # Add an extra gateway to repo_2's config |
| 7091 | + repo_2_config_path = repo_2_path / "config.yaml" |
| 7092 | + config_content = repo_2_config_path.read_text() |
| 7093 | + |
| 7094 | + modified_config = config_content.replace( |
| 7095 | + "default_gateway: local", |
| 7096 | + dedent(""" |
| 7097 | + extra: |
| 7098 | + connection: |
| 7099 | + type: duckdb |
| 7100 | + database: extra.duckdb |
| 7101 | +
|
| 7102 | + default_gateway: local |
| 7103 | + """), |
| 7104 | + ) |
| 7105 | + |
| 7106 | + repo_2_config_path.write_text(modified_config) |
| 7107 | + |
| 7108 | + # Create context with both repos but using the repo_1 path first |
| 7109 | + context = Context( |
| 7110 | + paths=(repo_1_path, repo_2_path), |
| 7111 | + gateway="memory", |
| 7112 | + ) |
| 7113 | + |
| 7114 | + # Verify all gateways from both repos are present |
| 7115 | + gathered_gateways = context.engine_adapters.keys() |
| 7116 | + expected_gateways = {"local", "memory", "extra"} |
| 7117 | + assert gathered_gateways == expected_gateways |
0 commit comments