[ Presubmit ] Add rule to prevent new tests from being added under runtime/observatory/tests/service
New service tests should be added to pkg/vm_service/test/ instead. Change-Id: I22460753478c21956f56b5c7c29cb3dfbc500c21 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350420 Reviewed-by: Jonas Termansen <sortie@google.com> Commit-Queue: Ben Konyi <bkonyi@google.com>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user