[core] Ship secrets referenced by remote package files in config bundles (#18053)

This commit is contained in:
J. Nick Koston
2026-08-04 11:05:52 -05:00
committed by GitHub
parent c2ddc17063
commit adb86a052c
7 changed files with 171 additions and 10 deletions
+47 -1
View File
@@ -282,8 +282,54 @@ test: !include_dir_named test_dir
assert ".hidden_dir" not in actual["test"]
def test_include_dir_list(tmp_path: Path) -> None:
"""!include_dir_list loads every .yaml file in the directory as a list."""
test_dir = tmp_path / "test_dir"
test_dir.mkdir()
(test_dir / "a.yaml").write_text("key: value_a")
(test_dir / "b.yaml").write_text("key: value_b")
test_yaml = tmp_path / "test.yaml"
test_yaml.write_text("test: !include_dir_list test_dir\n")
actual = yaml_util.load_yaml(test_yaml)
assert len(actual["test"]) == 2
assert {entry["key"] for entry in actual["test"]} == {"value_a", "value_b"}
def test_include_dir_merge_list(tmp_path: Path) -> None:
"""!include_dir_merge_list concatenates the lists from every .yaml file."""
test_dir = tmp_path / "test_dir"
test_dir.mkdir()
(test_dir / "a.yaml").write_text("- item_a1\n- item_a2\n")
(test_dir / "b.yaml").write_text("- item_b1\n")
test_yaml = tmp_path / "test.yaml"
test_yaml.write_text("test: !include_dir_merge_list test_dir\n")
actual = yaml_util.load_yaml(test_yaml)
assert sorted(actual["test"]) == ["item_a1", "item_a2", "item_b1"]
def test_include_dir_merge_named(tmp_path: Path) -> None:
"""!include_dir_merge_named merges the mappings from every .yaml file."""
test_dir = tmp_path / "test_dir"
test_dir.mkdir()
(test_dir / "a.yaml").write_text("key_a: value_a")
(test_dir / "b.yaml").write_text("key_b: value_b")
test_yaml = tmp_path / "test.yaml"
test_yaml.write_text("test: !include_dir_merge_named test_dir\n")
actual = yaml_util.load_yaml(test_yaml)
assert actual["test"] == {"key_a": "value_a", "key_b": "value_b"}
def test_find_files_recursive(fixture_path: Path, tmp_path: Path) -> None:
"""Test that _find_files works recursively through include_dir_named."""
"""Test that find_files works recursively through include_dir_named."""
# Copy fixture directory to temporary location
src_dir = fixture_path / "yaml_util"
dst_dir = tmp_path / "yaml_util"