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

Side by Side Diff: recipe_modules/bot_update/test_api.py

Issue 2311673002: Just disable force to ensure that bot_update really is running everywhere. (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « recipe_modules/bot_update/resources/bot_update.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import hashlib 5 import hashlib
6 import os 6 import os
7 import struct 7 import struct
8 import sys 8 import sys
9 from recipe_engine import recipe_test_api 9 from recipe_engine import recipe_test_api
10 10
11 # TODO(phajdan.jr): Clean up this somewhat ugly import.
12 sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'resources'))
13 import bot_update
14
15 11
16 class BotUpdateTestApi(recipe_test_api.RecipeTestApi): 12 class BotUpdateTestApi(recipe_test_api.RecipeTestApi):
17 def output_json(self, master, builder, slave, root, first_sln, 13 def output_json(self, master, builder, slave, root, first_sln,
18 revision_mapping, force=False, fail_patch=False, 14 revision_mapping, force=False, fail_patch=False,
19 output_manifest=False, fixed_revisions=None): 15 output_manifest=False, fixed_revisions=None):
20 """Deterministically synthesize json.output test data for gclient's 16 """Deterministically synthesize json.output test data for gclient's
21 --output-json option. 17 --output-json option.
22 """ 18 """
23 active = bot_update.check_valid_host(master, builder, slave) or force 19 active = True
24 20
25 output = { 21 output = {
26 'did_run': active, 22 'did_run': active,
27 'patch_failure': False 23 'patch_failure': False
28 } 24 }
29 25
30 # Add in extra json output if active. 26 # Add in extra json output if active.
31 if active: 27 if active:
32 properties = { 28 properties = {
33 property_name: self.gen_revision(project_name) 29 property_name: self.gen_revision(project_name)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 def gen_revision(project): 68 def gen_revision(project):
73 """Hash project to bogus deterministic git hash values.""" 69 """Hash project to bogus deterministic git hash values."""
74 h = hashlib.sha1(project) 70 h = hashlib.sha1(project)
75 return h.hexdigest() 71 return h.hexdigest()
76 72
77 @staticmethod 73 @staticmethod
78 def gen_commit_position(project): 74 def gen_commit_position(project):
79 """Hash project to bogus deterministic Cr-Commit-Position values.""" 75 """Hash project to bogus deterministic Cr-Commit-Position values."""
80 h = hashlib.sha1(project) 76 h = hashlib.sha1(project)
81 return struct.unpack('!I', h.digest()[:4])[0] % 300000 77 return struct.unpack('!I', h.digest()[:4])[0] % 300000
OLDNEW
« no previous file with comments | « recipe_modules/bot_update/resources/bot_update.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698