Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions synthtool/languages/node_mono_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ def walk_through_owlbot_dirs(dir: Path, search_for_changed_files: bool):
packages_to_exclude = [
r"packages/gapic-node-processing/templates/bootstrap-templates",
r"node_modules",
r"core/generator/gapic-generator-typescript/test-fixtures",
]
if search_for_changed_files:
try:
Expand Down
43 changes: 43 additions & 0 deletions tests/test_node_mono_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,49 @@ def test_walk_through_owlbot_dirs_handwritten(mock_subproc_popen):
assert any(re.search("handwritten/dlp", d) for d in owlbot_dirs)


@patch("subprocess.run")
def test_walk_through_owlbot_dirs_excluded(mock_subproc_popen):
process_mock = Mock()
attrs = {"communicate.return_value": ("output", "error")}
process_mock.configure_mock(**attrs)
mock_subproc_popen.return_value = process_mock

with util.copied_fixtures_dir(
FIXTURES / "nodejs_mono_repo_with_staging"
) as workdir:
excluded_dir = (
workdir
/ "core"
/ "generator"
/ "gapic-generator-typescript"
/ "test-fixtures"
/ "speech"
)
excluded_dir.mkdir(parents=True)
(excluded_dir / ".OwlBot.yaml").touch()

regular_dir = workdir / "core" / "generator" / "gapic-generator-typescript"
regular_dir.mkdir(parents=True, exist_ok=True)
(regular_dir / ".OwlBot.yaml").touch()

owlbot_dirs = node_mono_repo.walk_through_owlbot_dirs(
workdir, search_for_changed_files=False
)

assert not mock_subproc_popen.called
assert any(
re.search("core/generator/gapic-generator-typescript$", d)
for d in owlbot_dirs
)
assert not any(
re.search(
"core/generator/gapic-generator-typescript/test-fixtures/speech",
d,
)
for d in owlbot_dirs
)


@patch("subprocess.run")
def test_walk_through_owlbot_dirs_no_staging(mock_subproc_popen):
process_mock = Mock()
Expand Down
Loading