Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Unified Diff: recipe_modules/bot_update/test_api.py

Issue 1686273002: Bot update cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Review Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « recipe_modules/bot_update/resources/patch.exe ('k') | tests/bot_update_coverage_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_modules/bot_update/test_api.py
diff --git a/recipe_modules/bot_update/test_api.py b/recipe_modules/bot_update/test_api.py
index 64eab8ab1ee2b4bc175dfe5fb45607f2d2be6047..97fac0852210786670a68a143a01296af3354f7e 100644
--- a/recipe_modules/bot_update/test_api.py
+++ b/recipe_modules/bot_update/test_api.py
@@ -14,73 +14,61 @@ import bot_update
class BotUpdateTestApi(recipe_test_api.RecipeTestApi):
- def output_json(self, master, builder, slave, root, first_sln,
- revision_mapping, git_mode, force=False, fail_patch=False,
+ def output_json(self, root, first_sln, revision_mapping, fail_patch=False,
output_manifest=False, fixed_revisions=None):
"""Deterministically synthesize json.output test data for gclient's
--output-json option.
"""
- active = bot_update.check_valid_host(master, builder, slave) or force
output = {
- 'did_run': active,
+ 'did_run': True,
'patch_failure': False
}
- # Add in extra json output if active.
- if active:
- properties = {
- property_name: self.gen_revision(project_name, git_mode)
- for project_name, property_name in revision_mapping.iteritems()
- }
- properties.update({
- '%s_cp' % property_name: ('refs/heads/master@{#%s}' %
- self.gen_revision(project_name, False))
- for project_name, property_name in revision_mapping.iteritems()
- })
+ properties = {
+ property_name: self.gen_revision(project_name, True)
+ for project_name, property_name in revision_mapping.iteritems()
+ }
+ properties.update({
+ '%s_cp' % property_name: ('refs/heads/master@{#%s}' %
+ self.gen_revision(project_name, False))
+ for project_name, property_name in revision_mapping.iteritems()
+ })
- # We also want to simulate outputting "got_revision_git": ...
- # when git mode is off to match what bot_update.py does.
- if not git_mode:
- properties.update({
- '%s_git' % property_name: self.gen_revision(project_name, True)
- for project_name, property_name in revision_mapping.iteritems()
- })
+ output.update({
+ 'patch_root': root or first_sln,
+ 'root': first_sln,
+ 'properties': properties,
+ 'step_text': 'Some step text'
+ })
+ if output_manifest:
output.update({
- 'patch_root': root or first_sln,
- 'root': first_sln,
- 'properties': properties,
- 'step_text': 'Some step text'
- })
-
- if output_manifest:
- output.update({
- 'manifest': {
- project_name: {
- 'repository': 'https://fake.org/%s.git' % project_name,
- 'revision': self.gen_revision(project_name, git_mode),
- }
- for project_name in revision_mapping
+ 'manifest': {
+ project_name: {
+ 'repository': 'https://fake.org/%s.git' % project_name,
+ 'revision': self.gen_revision(project_name, True),
}
- })
+ for project_name in revision_mapping
+ }
+ })
- if fixed_revisions:
- output['fixed_revisions'] = fixed_revisions
+ if fixed_revisions:
+ output['fixed_revisions'] = fixed_revisions
- if fail_patch:
- output['log_lines'] = [('patch error', 'Patch failed to apply'),]
- output['patch_failure'] = True
- output['patch_apply_return_code'] = 1
- if fail_patch == 'download':
- output['patch_apply_return_code'] = 3
+ if fail_patch:
+ output['log_lines'] = [('patch error', 'Patch failed to apply'),]
+ output['patch_failure'] = True
+ output['patch_apply_return_code'] = 1
+ if fail_patch == 'download':
+ output['patch_apply_return_code'] = 3
return self.m.json.output(output)
@staticmethod
- def gen_revision(project, GIT_MODE):
+ def gen_revision(project, git_mode):
"""Hash project to bogus deterministic revision values."""
h = hashlib.sha1(project)
- if GIT_MODE:
+ if git_mode:
return h.hexdigest()
else:
return struct.unpack('!I', h.digest()[:4])[0] % 300000
« no previous file with comments | « recipe_modules/bot_update/resources/patch.exe ('k') | tests/bot_update_coverage_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698