Index: tools/telemetry/telemetry/user_story/user_story_runner.py |
diff --git a/tools/telemetry/telemetry/user_story/user_story_runner.py b/tools/telemetry/telemetry/user_story/user_story_runner.py |
index 52f569d142a0f439b9472b33d766c187f75d97dc..2eb1ca3eca6fa69a1264b4f383fc95d3acd3cc3d 100644 |
--- a/tools/telemetry/telemetry/user_story/user_story_runner.py |
+++ b/tools/telemetry/telemetry/user_story/user_story_runner.py |
@@ -205,7 +205,7 @@ def Run(test, user_story_set, expectations, finder_options, results): |
# patch. |
isinstance(user_story_set, page_set_module.PageSet)): |
_UpdateUserStoryArchivesIfChanged(user_story_set) |
- user_stories = _CheckArchives(user_story_set, user_stories, results) |
+ user_stories = _CheckArchives(user_story_set, user_stories) |
for user_story in list(user_stories): |
if not test.CanRunForPage(user_story): |
@@ -279,24 +279,29 @@ def _ShuffleAndFilterUserStorySet(user_story_set, finder_options): |
return user_stories |
-def _CheckArchives(page_set, pages, results): |
+def _CheckArchives(page_set, pages): |
"""Returns a subset of pages that are local or have WPR archives. |
Logs warnings if any are missing. |
""" |
- # Warn of any problems with the entire page set. |
+ # Error if there are any problems with the entire page set. |
if any(not p.is_local for p in pages): |
if not page_set.archive_data_file: |
- logging.warning('The page set is missing an "archive_data_file" ' |
- 'property. Skipping any live sites. To include them, ' |
- 'pass the flag --use-live-sites.') |
+ logging.error('The page set is missing an "archive_data_file" ' |
+ 'property. To run from live sites pass the flag ' |
+ '--use-live-sites. To create an archive file add an ' |
+ 'archive_data_file property to the page set and then ' |
+ 'run record_wpr.') |
+ raise Exception('No archive_data_file for page set.') |
dtu
2014/11/22 00:48:29
nit: raise some other kind of Error, not a generic
|
if not page_set.wpr_archive_info: |
- logging.warning('The archive info file is missing. ' |
- 'To fix this, either add svn-internal to your ' |
- '.gclient using http://goto/read-src-internal, ' |
- 'or create a new archive using record_wpr.') |
- |
- # Warn of any problems with individual pages and return valid pages. |
+ logging.error('The archive info file is missing. ' |
+ 'To fix this, either add svn-internal to your ' |
+ '.gclient using http://goto/read-src-internal, ' |
+ 'or create a new archive using record_wpr.') |
+ raise Exception('No wpr_archive_info for page set.') |
+ |
+ # Warn of any problems with individual pages and either throw an error or |
+ # return valid pages. |
pages_missing_archive_path = [] |
pages_missing_archive_data = [] |
valid_pages = [] |
@@ -308,21 +313,25 @@ def _CheckArchives(page_set, pages, results): |
else: |
valid_pages.append(page) |
if pages_missing_archive_path: |
- logging.warning('The page set archives for some pages do not exist. ' |
- 'Skipping those pages. To fix this, record those pages ' |
- 'using record_wpr. To ignore this warning and run ' |
- 'against live sites, pass the flag --use-live-sites.') |
+ logging.error('The page set archives for some pages do not exist. ' |
+ 'To fix this, record those pages using record_wpr. ' |
+ 'To ignore this warning and run against live sites, ' |
+ 'pass the flag --use-live-sites.') |
+ logging.error( |
+ 'Pages without archives: %s', |
+ ', '.join(page.display_name for page in pages_missing_archive_path)) |
if pages_missing_archive_data: |
- logging.warning('The page set archives for some pages are missing. ' |
- 'Someone forgot to check them in, or they were deleted. ' |
- 'Skipping those pages. To fix this, record those pages ' |
- 'using record_wpr. To ignore this warning and run ' |
- 'against live sites, pass the flag --use-live-sites.') |
- for page in pages_missing_archive_path + pages_missing_archive_data: |
- results.WillRunPage(page) |
- results.AddValue(failure.FailureValue.FromMessage( |
- page, 'Page set archive doesn\'t exist.')) |
- results.DidRunPage(page) |
+ logging.error('The page set archives for some pages are missing. ' |
+ 'Someone forgot to check them in, uploaded them to the ' |
+ 'wrong cloud storage bucket, or they were deleted. ' |
+ 'To fix this, record those pages using record_wpr. ' |
+ 'To ignore this warning and run against live sites, ' |
+ 'pass the flag --use-live-sites.') |
+ logging.error( |
+ 'Pages missing archives: %s', |
+ ', '.join(page.display_name for page in pages_missing_archive_data)) |
+ if pages_missing_archive_path or pages_missing_archive_data: |
+ raise Exception('Missing archives for some pages in page set.') |
return valid_pages |