diff --git a/synthtool/languages/node_mono_repo.py b/synthtool/languages/node_mono_repo.py index 46cfd3bc5..d4e36cd99 100644 --- a/synthtool/languages/node_mono_repo.py +++ b/synthtool/languages/node_mono_repo.py @@ -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: diff --git a/tests/test_node_mono_repo.py b/tests/test_node_mono_repo.py index c9e7880a1..fdb2dd08b 100644 --- a/tests/test_node_mono_repo.py +++ b/tests/test_node_mono_repo.py @@ -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()