diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 8d5762f815e..037fd0291e9 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -408,6 +408,26 @@ def _CheckCopyrightYear(input_api, output_api): ] +def _CheckNoNewObservatoryServiceTests(input_api, output_api): + """Ensures that no new tests are added to the Observatory test suite.""" + files = [] + + for f in input_api.AffectedFiles(include_deletes=False): + path = f.LocalPath() + if is_dart_file(path) and path.startswith( + "runtime/observatory/tests/service/") and f.Action( + ) == 'A' and os.path.isfile(path): + files.append(path) + + if not files: + return [] + + return [ + output_api.PresubmitError( + 'New VM service tests should be added to pkg/vm_service/test, ' + + 'not runtime/observatory/tests/service:\n' + '\n'.join(files)) + ] + def _CommonChecks(input_api, output_api): results = [] results.extend(_CheckValidHostsInDEPS(input_api, output_api)) @@ -420,6 +440,7 @@ def _CommonChecks(input_api, output_api): input_api.canned_checks.CheckPatchFormatted(input_api, output_api)) results.extend(_CheckCopyrightYear(input_api, output_api)) results.extend(_CheckAnalyzerFiles(input_api, output_api)) + results.extend(_CheckNoNewObservatoryServiceTests(input_api, output_api)) return results